@templatical/types 0.10.0 → 0.10.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/index.d.ts +566 -556
- package/dist/index.js +449 -579
- package/dist/index.js.map +1 -1
- package/package.json +3 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,189 +1,191 @@
|
|
|
1
|
+
//#region src/blocks.d.ts
|
|
1
2
|
interface SpacingValue {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
top: number;
|
|
4
|
+
right: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
left: number;
|
|
6
7
|
}
|
|
7
8
|
interface BlockStyles {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
padding: SpacingValue;
|
|
10
|
+
backgroundColor?: string;
|
|
10
11
|
}
|
|
11
12
|
interface BlockVisibility {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
desktop: boolean;
|
|
14
|
+
mobile: boolean;
|
|
14
15
|
}
|
|
15
16
|
interface BaseBlock {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
17
|
+
id: string;
|
|
18
|
+
type: string;
|
|
19
|
+
styles: BlockStyles;
|
|
20
|
+
visibility?: BlockVisibility;
|
|
21
|
+
displayCondition?: {
|
|
22
|
+
label: string;
|
|
23
|
+
before: string;
|
|
24
|
+
after: string;
|
|
25
|
+
group?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
};
|
|
27
28
|
}
|
|
28
29
|
type ColumnLayout = "1" | "2" | "3" | "2-1" | "1-2";
|
|
29
30
|
interface SectionBlock extends BaseBlock {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
type: "section";
|
|
32
|
+
columns: ColumnLayout;
|
|
33
|
+
children: Block[][];
|
|
33
34
|
}
|
|
34
35
|
type HeadingLevel = 1 | 2 | 3 | 4;
|
|
35
36
|
declare const HEADING_LEVEL_FONT_SIZE: Record<HeadingLevel, number>;
|
|
36
37
|
interface TitleBlock extends BaseBlock {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
type: "title";
|
|
39
|
+
content: string;
|
|
40
|
+
level: HeadingLevel;
|
|
41
|
+
color: string;
|
|
42
|
+
textAlign: "left" | "center" | "right";
|
|
43
|
+
fontFamily?: string;
|
|
43
44
|
}
|
|
44
45
|
interface ParagraphBlock extends BaseBlock {
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
type: "paragraph";
|
|
47
|
+
content: string;
|
|
47
48
|
}
|
|
48
49
|
interface ImageBlock extends BaseBlock {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
50
|
+
type: "image";
|
|
51
|
+
src: string;
|
|
52
|
+
alt: string;
|
|
53
|
+
width: number | "full";
|
|
54
|
+
align: "left" | "center" | "right";
|
|
55
|
+
linkUrl?: string;
|
|
56
|
+
linkOpenInNewTab?: boolean;
|
|
57
|
+
placeholderUrl?: string;
|
|
58
|
+
decorative?: boolean;
|
|
58
59
|
}
|
|
59
60
|
interface ButtonBlock extends BaseBlock {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
type: "button";
|
|
62
|
+
text: string;
|
|
63
|
+
url: string;
|
|
64
|
+
openInNewTab?: boolean;
|
|
65
|
+
backgroundColor: string;
|
|
66
|
+
textColor: string;
|
|
67
|
+
borderRadius: number;
|
|
68
|
+
fontSize: number;
|
|
69
|
+
buttonPadding: SpacingValue;
|
|
70
|
+
fontFamily?: string;
|
|
70
71
|
}
|
|
71
72
|
interface DividerBlock extends BaseBlock {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
73
|
+
type: "divider";
|
|
74
|
+
lineStyle: "solid" | "dashed" | "dotted";
|
|
75
|
+
color: string;
|
|
76
|
+
thickness: number;
|
|
77
|
+
width: number | "full";
|
|
77
78
|
}
|
|
78
79
|
interface VideoBlock extends BaseBlock {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
type: "video";
|
|
81
|
+
url: string;
|
|
82
|
+
openInNewTab?: boolean;
|
|
83
|
+
thumbnailUrl: string;
|
|
84
|
+
alt: string;
|
|
85
|
+
width: number | "full";
|
|
86
|
+
align: "left" | "center" | "right";
|
|
87
|
+
placeholderUrl?: string;
|
|
87
88
|
}
|
|
88
89
|
type SocialPlatform = "facebook" | "twitter" | "instagram" | "linkedin" | "youtube" | "tiktok" | "pinterest" | "email" | "whatsapp" | "telegram" | "discord" | "snapchat" | "reddit" | "github" | "dribbble" | "behance";
|
|
89
90
|
type SocialIconStyle = "solid" | "outlined" | "rounded" | "square" | "circle";
|
|
90
91
|
type SocialIconSize = "small" | "medium" | "large";
|
|
91
92
|
interface SocialIcon {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
id: string;
|
|
94
|
+
platform: SocialPlatform;
|
|
95
|
+
url: string;
|
|
95
96
|
}
|
|
96
97
|
interface SocialIconsBlock extends BaseBlock {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
type: "social";
|
|
99
|
+
icons: SocialIcon[];
|
|
100
|
+
iconStyle: SocialIconStyle;
|
|
101
|
+
iconSize: SocialIconSize;
|
|
102
|
+
spacing: number;
|
|
103
|
+
align: "left" | "center" | "right";
|
|
103
104
|
}
|
|
104
105
|
interface SpacerBlock extends BaseBlock {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
type: "spacer";
|
|
107
|
+
height: number;
|
|
107
108
|
}
|
|
108
109
|
interface HtmlBlock extends BaseBlock {
|
|
109
|
-
|
|
110
|
-
|
|
110
|
+
type: "html";
|
|
111
|
+
content: string;
|
|
111
112
|
}
|
|
112
113
|
interface MenuItemData {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
114
|
+
id: string;
|
|
115
|
+
text: string;
|
|
116
|
+
url: string;
|
|
117
|
+
openInNewTab: boolean;
|
|
118
|
+
bold: boolean;
|
|
119
|
+
underline: boolean;
|
|
120
|
+
color?: string;
|
|
120
121
|
}
|
|
121
122
|
interface MenuBlock extends BaseBlock {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
123
|
+
type: "menu";
|
|
124
|
+
items: MenuItemData[];
|
|
125
|
+
fontSize: number;
|
|
126
|
+
fontFamily?: string;
|
|
127
|
+
color: string;
|
|
128
|
+
linkColor?: string;
|
|
129
|
+
textAlign: "left" | "center" | "right";
|
|
130
|
+
separator: string;
|
|
131
|
+
separatorColor: string;
|
|
132
|
+
spacing: number;
|
|
132
133
|
}
|
|
133
134
|
interface TableCellData {
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
id: string;
|
|
136
|
+
content: string;
|
|
136
137
|
}
|
|
137
138
|
interface TableRowData {
|
|
138
|
-
|
|
139
|
-
|
|
139
|
+
id: string;
|
|
140
|
+
cells: TableCellData[];
|
|
140
141
|
}
|
|
141
142
|
interface TableBlock extends BaseBlock {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
143
|
+
type: "table";
|
|
144
|
+
rows: TableRowData[];
|
|
145
|
+
hasHeaderRow: boolean;
|
|
146
|
+
headerBackgroundColor?: string;
|
|
147
|
+
borderColor: string;
|
|
148
|
+
borderWidth: number;
|
|
149
|
+
cellPadding: number;
|
|
150
|
+
fontSize: number;
|
|
151
|
+
fontFamily?: string;
|
|
152
|
+
color: string;
|
|
153
|
+
textAlign: "left" | "center" | "right";
|
|
153
154
|
}
|
|
154
155
|
interface CountdownBlock extends BaseBlock {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
156
|
+
type: "countdown";
|
|
157
|
+
targetDate: string;
|
|
158
|
+
timezone: string;
|
|
159
|
+
showDays: boolean;
|
|
160
|
+
showHours: boolean;
|
|
161
|
+
showMinutes: boolean;
|
|
162
|
+
showSeconds: boolean;
|
|
163
|
+
separator: ":" | "-" | " ";
|
|
164
|
+
digitFontSize: number;
|
|
165
|
+
digitColor: string;
|
|
166
|
+
labelColor: string;
|
|
167
|
+
labelFontSize: number;
|
|
168
|
+
backgroundColor: string;
|
|
169
|
+
fontFamily?: string;
|
|
170
|
+
labelDays: string;
|
|
171
|
+
labelHours: string;
|
|
172
|
+
labelMinutes: string;
|
|
173
|
+
labelSeconds: string;
|
|
174
|
+
expiredMessage: string;
|
|
175
|
+
expiredImageUrl: string;
|
|
176
|
+
hideOnExpiry: boolean;
|
|
176
177
|
}
|
|
177
178
|
interface CustomBlock extends BaseBlock {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
179
|
+
type: "custom";
|
|
180
|
+
customType: string;
|
|
181
|
+
fieldValues: Record<string, unknown>;
|
|
182
|
+
renderedHtml?: string;
|
|
183
|
+
dataSourceFetched?: boolean;
|
|
183
184
|
}
|
|
184
185
|
type Block = SectionBlock | TitleBlock | ParagraphBlock | ImageBlock | ButtonBlock | DividerBlock | VideoBlock | SocialIconsBlock | SpacerBlock | HtmlBlock | MenuBlock | TableBlock | CountdownBlock | CustomBlock;
|
|
185
186
|
type BlockType = Block["type"];
|
|
186
|
-
|
|
187
|
+
//#endregion
|
|
188
|
+
//#region src/guards.d.ts
|
|
187
189
|
declare function isSection(block: Block): block is SectionBlock;
|
|
188
190
|
declare function isTitle(block: Block): block is TitleBlock;
|
|
189
191
|
declare function isParagraph(block: Block): block is ParagraphBlock;
|
|
@@ -198,22 +200,23 @@ declare function isMenu(block: Block): block is MenuBlock;
|
|
|
198
200
|
declare function isTable(block: Block): block is TableBlock;
|
|
199
201
|
declare function isCountdown(block: Block): block is CountdownBlock;
|
|
200
202
|
declare function isCustomBlock(block: Block): block is CustomBlock;
|
|
201
|
-
|
|
203
|
+
//#endregion
|
|
204
|
+
//#region src/defaults.d.ts
|
|
202
205
|
type BlockDefaultsFor<T> = Partial<Omit<T, "id" | "type">>;
|
|
203
206
|
interface BlockDefaults {
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
title?: BlockDefaultsFor<TitleBlock>;
|
|
208
|
+
paragraph?: BlockDefaultsFor<ParagraphBlock>;
|
|
209
|
+
image?: BlockDefaultsFor<ImageBlock>;
|
|
210
|
+
button?: BlockDefaultsFor<ButtonBlock>;
|
|
211
|
+
divider?: BlockDefaultsFor<DividerBlock>;
|
|
212
|
+
section?: BlockDefaultsFor<SectionBlock>;
|
|
213
|
+
video?: BlockDefaultsFor<VideoBlock>;
|
|
214
|
+
social?: BlockDefaultsFor<SocialIconsBlock>;
|
|
215
|
+
spacer?: BlockDefaultsFor<SpacerBlock>;
|
|
216
|
+
html?: BlockDefaultsFor<HtmlBlock>;
|
|
217
|
+
menu?: BlockDefaultsFor<MenuBlock>;
|
|
218
|
+
table?: BlockDefaultsFor<TableBlock>;
|
|
219
|
+
countdown?: BlockDefaultsFor<CountdownBlock>;
|
|
217
220
|
}
|
|
218
221
|
type TemplateDefaults = Partial<TemplateSettings>;
|
|
219
222
|
declare const TITLE_BLOCK_DEFAULTS: BlockDefaultsFor<TitleBlock>;
|
|
@@ -232,128 +235,129 @@ declare const COUNTDOWN_BLOCK_DEFAULTS: BlockDefaultsFor<CountdownBlock>;
|
|
|
232
235
|
declare const DEFAULT_BLOCK_DEFAULTS: Required<BlockDefaults>;
|
|
233
236
|
declare const DEFAULT_TEMPLATE_DEFAULTS: TemplateDefaults;
|
|
234
237
|
declare function deepMergeDefaults<T extends object>(base: T, overrides: Partial<T>): T;
|
|
235
|
-
|
|
238
|
+
//#endregion
|
|
239
|
+
//#region src/template.d.ts
|
|
236
240
|
interface TemplateSettings {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
241
|
+
width: number;
|
|
242
|
+
backgroundColor: string;
|
|
243
|
+
fontFamily: string;
|
|
244
|
+
preheaderText?: string;
|
|
245
|
+
/**
|
|
246
|
+
* BCP-47 language code for the rendered email's `<html lang>`. Drives
|
|
247
|
+
* screen-reader pronunciation. Default `'en'` via `DEFAULT_TEMPLATE_DEFAULTS`.
|
|
248
|
+
*/
|
|
249
|
+
locale: string;
|
|
246
250
|
}
|
|
247
251
|
interface TemplateContent {
|
|
248
|
-
|
|
249
|
-
|
|
252
|
+
blocks: Block[];
|
|
253
|
+
settings: TemplateSettings;
|
|
250
254
|
}
|
|
251
255
|
declare function createDefaultTemplateContent(defaultFontFamily?: string, templateDefaults?: TemplateDefaults): TemplateContent;
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
256
|
+
//#endregion
|
|
257
|
+
//#region src/custom-blocks.d.ts
|
|
255
258
|
type CustomBlockFieldType = "text" | "textarea" | "image" | "color" | "number" | "select" | "boolean" | "repeatable";
|
|
256
259
|
interface CustomBlockFieldBase {
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
260
|
+
key: string;
|
|
261
|
+
label: string;
|
|
262
|
+
required?: boolean;
|
|
263
|
+
placeholder?: string;
|
|
264
|
+
readOnly?: boolean;
|
|
262
265
|
}
|
|
263
266
|
interface CustomBlockTextField extends CustomBlockFieldBase {
|
|
264
|
-
|
|
265
|
-
|
|
267
|
+
type: "text";
|
|
268
|
+
default?: string;
|
|
266
269
|
}
|
|
267
270
|
interface CustomBlockTextareaField extends CustomBlockFieldBase {
|
|
268
|
-
|
|
269
|
-
|
|
271
|
+
type: "textarea";
|
|
272
|
+
default?: string;
|
|
270
273
|
}
|
|
271
274
|
interface CustomBlockImageField extends CustomBlockFieldBase {
|
|
272
|
-
|
|
273
|
-
|
|
275
|
+
type: "image";
|
|
276
|
+
default?: string;
|
|
274
277
|
}
|
|
275
278
|
interface CustomBlockColorField extends CustomBlockFieldBase {
|
|
276
|
-
|
|
277
|
-
|
|
279
|
+
type: "color";
|
|
280
|
+
default?: string;
|
|
278
281
|
}
|
|
279
282
|
interface CustomBlockNumberField extends CustomBlockFieldBase {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
type: "number";
|
|
284
|
+
default?: number;
|
|
285
|
+
min?: number;
|
|
286
|
+
max?: number;
|
|
287
|
+
step?: number;
|
|
285
288
|
}
|
|
286
289
|
interface SelectOption {
|
|
287
|
-
|
|
288
|
-
|
|
290
|
+
label: string;
|
|
291
|
+
value: string;
|
|
289
292
|
}
|
|
290
293
|
interface CustomBlockSelectField extends CustomBlockFieldBase {
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
+
type: "select";
|
|
295
|
+
options: SelectOption[];
|
|
296
|
+
default?: string;
|
|
294
297
|
}
|
|
295
298
|
interface CustomBlockBooleanField extends CustomBlockFieldBase {
|
|
296
|
-
|
|
297
|
-
|
|
299
|
+
type: "boolean";
|
|
300
|
+
default?: boolean;
|
|
298
301
|
}
|
|
299
302
|
interface CustomBlockRepeatableField extends CustomBlockFieldBase {
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
303
|
+
type: "repeatable";
|
|
304
|
+
fields: Exclude<CustomBlockField, CustomBlockRepeatableField>[];
|
|
305
|
+
default?: Record<string, unknown>[];
|
|
306
|
+
minItems?: number;
|
|
307
|
+
maxItems?: number;
|
|
305
308
|
}
|
|
306
309
|
type CustomBlockField = CustomBlockTextField | CustomBlockTextareaField | CustomBlockImageField | CustomBlockColorField | CustomBlockNumberField | CustomBlockSelectField | CustomBlockBooleanField | CustomBlockRepeatableField;
|
|
307
310
|
interface CustomBlockDefinition {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
311
|
+
type: string;
|
|
312
|
+
name: string;
|
|
313
|
+
icon?: string;
|
|
314
|
+
description?: string;
|
|
315
|
+
fields: CustomBlockField[];
|
|
316
|
+
template: string;
|
|
317
|
+
dataSource?: DataSourceConfig;
|
|
318
|
+
/**
|
|
319
|
+
* Default block styles applied when a new instance of this custom block is
|
|
320
|
+
* created. Deep-merged over the built-in defaults — only specify the fields
|
|
321
|
+
* you want to override. Controls both the editor canvas wrapper and the
|
|
322
|
+
* rendered MJML/email output.
|
|
323
|
+
*
|
|
324
|
+
* @example
|
|
325
|
+
* defaultStyles: {
|
|
326
|
+
* padding: { top: 0, right: 0, bottom: 0, left: 0 },
|
|
327
|
+
* }
|
|
328
|
+
*/
|
|
329
|
+
defaultStyles?: Partial<BlockStyles>;
|
|
330
|
+
/**
|
|
331
|
+
* Optional CSS rules attached to this custom block definition. Emitted once
|
|
332
|
+
* (deduped across instances) into `<mj-head><mj-style>…</mj-style></mj-head>`
|
|
333
|
+
* in the rendered MJML, and adopted into the editor canvas (shadow root or
|
|
334
|
+
* light-DOM mount) so authored responsive/hover/font behavior previews
|
|
335
|
+
* inside the editor.
|
|
336
|
+
*
|
|
337
|
+
* Use this for media queries, hover states, or any CSS that should apply
|
|
338
|
+
* once per definition rather than per block instance. Class names are not
|
|
339
|
+
* scoped by the SDK — namespace them yourself (e.g. `.tplc-<type>-<el>`) to
|
|
340
|
+
* avoid collisions with other definitions or built-in editor styles.
|
|
341
|
+
*
|
|
342
|
+
* @example
|
|
343
|
+
* stylesheet: `
|
|
344
|
+
* @media (max-width: 480px) {
|
|
345
|
+
* .tplc-image-text-cell { display: block !important; width: 100% !important; }
|
|
346
|
+
* }
|
|
347
|
+
* `
|
|
348
|
+
*/
|
|
349
|
+
stylesheet?: string;
|
|
347
350
|
}
|
|
348
351
|
interface DataSourceFetchContext {
|
|
349
|
-
|
|
350
|
-
|
|
352
|
+
fieldValues: Record<string, unknown>;
|
|
353
|
+
blockId: string;
|
|
351
354
|
}
|
|
352
355
|
interface DataSourceConfig {
|
|
353
|
-
|
|
354
|
-
|
|
356
|
+
label: string;
|
|
357
|
+
onFetch: (context: DataSourceFetchContext) => Promise<Record<string, unknown> | null>;
|
|
355
358
|
}
|
|
356
|
-
|
|
359
|
+
//#endregion
|
|
360
|
+
//#region src/factory.d.ts
|
|
357
361
|
declare function generateId(): string;
|
|
358
362
|
declare function createTitleBlock(partial?: Partial<TitleBlock>): TitleBlock;
|
|
359
363
|
declare function createParagraphBlock(partial?: Partial<ParagraphBlock>): ParagraphBlock;
|
|
@@ -371,114 +375,117 @@ declare function createCountdownBlock(partial?: Partial<CountdownBlock>): Countd
|
|
|
371
375
|
declare function createCustomBlock(definition: CustomBlockDefinition): CustomBlock;
|
|
372
376
|
declare function createBlock(type: BlockType, blockDefaults?: BlockDefaults): Block;
|
|
373
377
|
declare function cloneBlock(block: Block): Block;
|
|
374
|
-
|
|
378
|
+
//#endregion
|
|
379
|
+
//#region src/events.d.ts
|
|
375
380
|
declare class EventEmitter<TEvents extends Record<string, unknown> = Record<string, unknown>> {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
}
|
|
383
|
-
|
|
381
|
+
private handlers;
|
|
382
|
+
on<K extends keyof TEvents>(event: K, handler: (data: TEvents[K]) => void): () => void;
|
|
383
|
+
off<K extends keyof TEvents>(event: K, handler: (data: TEvents[K]) => void): void;
|
|
384
|
+
emit<K extends keyof TEvents>(event: K, data: TEvents[K]): void;
|
|
385
|
+
removeAllListeners(event?: keyof TEvents): void;
|
|
386
|
+
listenerCount(event: keyof TEvents): number;
|
|
387
|
+
}
|
|
388
|
+
//#endregion
|
|
389
|
+
//#region src/config.d.ts
|
|
384
390
|
type ViewportSize = "desktop" | "mobile";
|
|
385
391
|
type UiTheme = "light" | "dark" | "auto";
|
|
386
392
|
interface CustomFont {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
393
|
+
name: string;
|
|
394
|
+
url: string;
|
|
395
|
+
fallback?: string;
|
|
390
396
|
}
|
|
391
397
|
interface FontsConfig {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
398
|
+
defaultFallback?: string;
|
|
399
|
+
defaultFont?: string;
|
|
400
|
+
customFonts?: CustomFont[];
|
|
395
401
|
}
|
|
396
402
|
interface ExportResult {
|
|
397
|
-
|
|
398
|
-
|
|
403
|
+
html: string;
|
|
404
|
+
mjml: string;
|
|
399
405
|
}
|
|
400
406
|
interface MergeTag {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
407
|
+
label: string;
|
|
408
|
+
value: string;
|
|
409
|
+
/**
|
|
410
|
+
* Optional grouping label used by the built-in merge tag picker to
|
|
411
|
+
* section the list. When no tag in the configured array carries
|
|
412
|
+
* `group`, the picker renders a plain flat list with no headers.
|
|
413
|
+
* Ignored by the renderer and by typing-autocomplete.
|
|
414
|
+
*/
|
|
415
|
+
group?: string;
|
|
416
|
+
/**
|
|
417
|
+
* Optional helper text shown beneath the tag in the built-in merge
|
|
418
|
+
* tag picker. Not rendered anywhere else (toolbar, autocomplete,
|
|
419
|
+
* MJML output) and not stored on the inserted document node.
|
|
420
|
+
*/
|
|
421
|
+
description?: string;
|
|
416
422
|
}
|
|
417
423
|
interface MediaResult {
|
|
418
|
-
|
|
419
|
-
|
|
424
|
+
url: string;
|
|
425
|
+
alt?: string;
|
|
420
426
|
}
|
|
421
427
|
interface MergeTagsConfig {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
428
|
+
syntax?: SyntaxPresetName | SyntaxPreset;
|
|
429
|
+
tags?: MergeTag[];
|
|
430
|
+
onRequest?: () => Promise<MergeTag | null>;
|
|
431
|
+
/**
|
|
432
|
+
* Enables typing-based autocomplete in rich text fields. When the user
|
|
433
|
+
* types the syntax opener (e.g. `{{`), a popup lists matching `tags`.
|
|
434
|
+
*
|
|
435
|
+
* Defaults to `true`. Effective only when `tags` is non-empty AND
|
|
436
|
+
* `syntax` matches a built-in preset (custom regex syntaxes cannot be
|
|
437
|
+
* mapped to a trigger string and silently disable autocomplete).
|
|
438
|
+
*/
|
|
439
|
+
autocomplete?: boolean;
|
|
434
440
|
}
|
|
435
441
|
interface DisplayCondition {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
442
|
+
label: string;
|
|
443
|
+
before: string;
|
|
444
|
+
after: string;
|
|
445
|
+
group?: string;
|
|
446
|
+
description?: string;
|
|
441
447
|
}
|
|
442
448
|
interface DisplayConditionsConfig {
|
|
443
|
-
|
|
444
|
-
|
|
449
|
+
conditions: DisplayCondition[];
|
|
450
|
+
allowCustom?: boolean;
|
|
445
451
|
}
|
|
446
452
|
interface ThemeOverrides {
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
453
|
+
bg?: string;
|
|
454
|
+
bgElevated?: string;
|
|
455
|
+
bgHover?: string;
|
|
456
|
+
bgActive?: string;
|
|
457
|
+
border?: string;
|
|
458
|
+
borderLight?: string;
|
|
459
|
+
text?: string;
|
|
460
|
+
textMuted?: string;
|
|
461
|
+
textDim?: string;
|
|
462
|
+
primary?: string;
|
|
463
|
+
primaryHover?: string;
|
|
464
|
+
primaryLight?: string;
|
|
465
|
+
secondary?: string;
|
|
466
|
+
secondaryHover?: string;
|
|
467
|
+
secondaryLight?: string;
|
|
468
|
+
success?: string;
|
|
469
|
+
successLight?: string;
|
|
470
|
+
warning?: string;
|
|
471
|
+
warningLight?: string;
|
|
472
|
+
danger?: string;
|
|
473
|
+
dangerLight?: string;
|
|
474
|
+
canvasBg?: string;
|
|
475
|
+
dark?: Omit<ThemeOverrides, "dark">;
|
|
470
476
|
}
|
|
471
477
|
declare class SdkError extends Error {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
478
|
+
readonly statusCode?: number | undefined;
|
|
479
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
480
|
+
get isNotFound(): boolean;
|
|
481
|
+
get isUnauthorized(): boolean;
|
|
482
|
+
get isServerError(): boolean;
|
|
483
|
+
}
|
|
484
|
+
//#endregion
|
|
485
|
+
//#region src/merge-tags.d.ts
|
|
479
486
|
interface SyntaxPreset {
|
|
480
|
-
|
|
481
|
-
|
|
487
|
+
value: RegExp;
|
|
488
|
+
logic: RegExp;
|
|
482
489
|
}
|
|
483
490
|
type SyntaxPresetName = "liquid" | "handlebars" | "mailchimp" | "ampscript";
|
|
484
491
|
declare const SYNTAX_PRESETS: Record<SyntaxPresetName, SyntaxPreset>;
|
|
@@ -497,331 +504,334 @@ declare function restoreMergeTagMarkup(html: string, mergeTags: MergeTag[], synt
|
|
|
497
504
|
declare function isLogicMergeTagValue(value: string, syntax: SyntaxPreset): boolean;
|
|
498
505
|
declare function getLogicMergeTagKeyword(value: string, syntax: SyntaxPreset): string;
|
|
499
506
|
declare function resolveHtmlLogicMergeTagLabels(html: string, syntax: SyntaxPreset): string;
|
|
500
|
-
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region ../media-library/src/types.d.ts
|
|
501
509
|
type MediaCategory = "images" | "documents" | "videos" | "audio";
|
|
502
510
|
interface MediaItem {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
511
|
+
id: string;
|
|
512
|
+
filename: string;
|
|
513
|
+
mime_type: string;
|
|
514
|
+
size: number;
|
|
515
|
+
url: string;
|
|
516
|
+
small_url: string | null;
|
|
517
|
+
medium_url: string | null;
|
|
518
|
+
large_url: string | null;
|
|
519
|
+
folder_id: string | null;
|
|
520
|
+
conversions_generated: boolean;
|
|
521
|
+
width: number | null;
|
|
522
|
+
height: number | null;
|
|
523
|
+
alt_text: string;
|
|
524
|
+
created_at: string;
|
|
525
|
+
updated_at: string;
|
|
518
526
|
}
|
|
519
527
|
interface MediaRequestContext {
|
|
520
|
-
|
|
528
|
+
accept?: MediaCategory[];
|
|
521
529
|
}
|
|
522
530
|
interface StorageInfo {
|
|
523
|
-
|
|
524
|
-
|
|
531
|
+
used_bytes: number;
|
|
532
|
+
limit_bytes: number;
|
|
525
533
|
}
|
|
526
534
|
interface MediaCategoryData {
|
|
527
|
-
|
|
528
|
-
|
|
535
|
+
mime_types: string[];
|
|
536
|
+
extensions: string[];
|
|
529
537
|
}
|
|
530
538
|
interface MediaConfig {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
539
|
+
use_media_library: boolean;
|
|
540
|
+
categories: Record<string, MediaCategoryData>;
|
|
541
|
+
max_file_size: number;
|
|
534
542
|
}
|
|
535
|
-
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region src/cloud.d.ts
|
|
536
545
|
interface Template {
|
|
537
|
-
|
|
538
|
-
|
|
546
|
+
id: string;
|
|
547
|
+
content: TemplateContent;
|
|
539
548
|
}
|
|
540
549
|
interface TemplateSnapshot {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
550
|
+
id: string;
|
|
551
|
+
template_id: string;
|
|
552
|
+
content: TemplateContent;
|
|
553
|
+
is_autosave: boolean;
|
|
554
|
+
created_at: string;
|
|
546
555
|
}
|
|
547
556
|
interface Comment {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
557
|
+
id: string;
|
|
558
|
+
template_id: string;
|
|
559
|
+
block_id: string | null;
|
|
560
|
+
parent_id: string | null;
|
|
561
|
+
body: string;
|
|
562
|
+
author_identifier: string;
|
|
563
|
+
author_name: string;
|
|
564
|
+
resolved_at: string | null;
|
|
565
|
+
resolved_by_identifier: string | null;
|
|
566
|
+
resolved_by_name: string | null;
|
|
567
|
+
created_at: string;
|
|
568
|
+
updated_at: string;
|
|
569
|
+
replies: Comment[];
|
|
561
570
|
}
|
|
562
571
|
type CommentThread = Comment;
|
|
563
572
|
type CommentEventType = "created" | "updated" | "deleted" | "resolved" | "unresolved";
|
|
564
573
|
interface CommentEvent {
|
|
565
|
-
|
|
566
|
-
|
|
574
|
+
type: CommentEventType;
|
|
575
|
+
comment: Comment;
|
|
567
576
|
}
|
|
568
577
|
interface SavedModule {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
578
|
+
id: string;
|
|
579
|
+
name: string;
|
|
580
|
+
content: Block[];
|
|
581
|
+
created_at: string;
|
|
582
|
+
updated_at: string;
|
|
574
583
|
}
|
|
575
584
|
type FindingSeverity = "high" | "medium" | "low";
|
|
576
585
|
type ScoringCategory = "spam" | "readability" | "accessibility" | "bestPractices";
|
|
577
586
|
interface ScoringFinding {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
587
|
+
id: string;
|
|
588
|
+
severity: FindingSeverity;
|
|
589
|
+
message: string;
|
|
590
|
+
blockId: string | null;
|
|
591
|
+
category: ScoringCategory;
|
|
592
|
+
suggestion: string;
|
|
584
593
|
}
|
|
585
594
|
interface CategoryScore {
|
|
586
|
-
|
|
587
|
-
|
|
595
|
+
score: number;
|
|
596
|
+
findings: ScoringFinding[];
|
|
588
597
|
}
|
|
589
598
|
interface ScoringResult {
|
|
590
|
-
|
|
591
|
-
|
|
599
|
+
score: number;
|
|
600
|
+
categories: Record<ScoringCategory, CategoryScore>;
|
|
592
601
|
}
|
|
593
602
|
interface HealthCheckResult {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
603
|
+
api: {
|
|
604
|
+
ok: boolean;
|
|
605
|
+
latency: number;
|
|
606
|
+
};
|
|
607
|
+
websocket: {
|
|
608
|
+
ok: boolean;
|
|
609
|
+
error?: string;
|
|
610
|
+
};
|
|
611
|
+
auth: {
|
|
612
|
+
ok: boolean;
|
|
613
|
+
error?: string;
|
|
614
|
+
};
|
|
615
|
+
overall: boolean;
|
|
607
616
|
}
|
|
608
617
|
interface TokenData {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
618
|
+
token: string;
|
|
619
|
+
expires_at: number;
|
|
620
|
+
project_id: string;
|
|
621
|
+
tenant: string;
|
|
622
|
+
test_email?: {
|
|
623
|
+
allowed_emails: string[];
|
|
624
|
+
signature: string;
|
|
625
|
+
};
|
|
626
|
+
user?: {
|
|
627
|
+
id: string;
|
|
628
|
+
name: string;
|
|
629
|
+
signature: string;
|
|
630
|
+
};
|
|
622
631
|
}
|
|
623
632
|
interface AuthRequestOptions {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
633
|
+
method?: "GET" | "POST";
|
|
634
|
+
headers?: Record<string, string>;
|
|
635
|
+
body?: Record<string, unknown>;
|
|
636
|
+
credentials?: RequestCredentials;
|
|
628
637
|
}
|
|
629
638
|
interface AuthConfig {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
639
|
+
url: string;
|
|
640
|
+
baseUrl?: string;
|
|
641
|
+
requestOptions?: AuthRequestOptions;
|
|
642
|
+
onError?: (error: Error) => void;
|
|
634
643
|
}
|
|
635
644
|
interface TestEmailConfig {
|
|
636
|
-
|
|
637
|
-
|
|
645
|
+
allowedEmails: string[];
|
|
646
|
+
signature: string;
|
|
638
647
|
}
|
|
639
648
|
interface UserConfig {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
649
|
+
id: string;
|
|
650
|
+
name: string;
|
|
651
|
+
signature: string;
|
|
643
652
|
}
|
|
644
653
|
interface DirectAuthConfig {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
654
|
+
mode: "direct";
|
|
655
|
+
clientId: string;
|
|
656
|
+
clientSecret: string;
|
|
657
|
+
tenant: string;
|
|
658
|
+
baseUrl?: string;
|
|
650
659
|
}
|
|
651
660
|
interface ProxyAuthConfig {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
661
|
+
mode: "proxy";
|
|
662
|
+
url: string;
|
|
663
|
+
baseUrl?: string;
|
|
664
|
+
requestOptions?: AuthRequestOptions;
|
|
656
665
|
}
|
|
657
666
|
type SdkAuthConfig = DirectAuthConfig | ProxyAuthConfig;
|
|
658
667
|
interface Collaborator {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
668
|
+
id: string;
|
|
669
|
+
name: string;
|
|
670
|
+
color: string;
|
|
671
|
+
selectedBlockId: string | null;
|
|
663
672
|
}
|
|
664
673
|
type McpOperation = "add_block" | "update_block" | "delete_block" | "move_block" | "update_settings" | "set_content" | "update_block_style";
|
|
665
674
|
interface McpOperationPayload {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
675
|
+
operation: McpOperation;
|
|
676
|
+
data: Record<string, unknown>;
|
|
677
|
+
timestamp: number;
|
|
669
678
|
}
|
|
670
679
|
interface SaveResult {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
680
|
+
templateId: string;
|
|
681
|
+
html: string;
|
|
682
|
+
mjml: string;
|
|
683
|
+
content: TemplateContent;
|
|
675
684
|
}
|
|
676
685
|
interface AiConfig {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
686
|
+
chat?: boolean;
|
|
687
|
+
scoring?: boolean;
|
|
688
|
+
designToTemplate?: boolean;
|
|
689
|
+
rewrite?: boolean;
|
|
681
690
|
}
|
|
682
691
|
interface McpConfig {
|
|
683
|
-
|
|
684
|
-
|
|
692
|
+
enabled: boolean;
|
|
693
|
+
onOperation?: (payload: McpOperationPayload) => void;
|
|
685
694
|
}
|
|
686
695
|
interface CollaborationConfig {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
696
|
+
enabled: boolean;
|
|
697
|
+
onCollaboratorJoined?: (collaborator: Collaborator) => void;
|
|
698
|
+
onCollaboratorLeft?: (collaborator: Collaborator) => void;
|
|
699
|
+
onBlockLocked?: (event: {
|
|
700
|
+
blockId: string;
|
|
701
|
+
collaborator: Collaborator;
|
|
702
|
+
}) => void;
|
|
703
|
+
onBlockUnlocked?: (event: {
|
|
704
|
+
blockId: string;
|
|
705
|
+
collaborator: Collaborator;
|
|
706
|
+
}) => void;
|
|
698
707
|
}
|
|
699
708
|
interface WebSocketServerConfig {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
709
|
+
host: string;
|
|
710
|
+
port: number;
|
|
711
|
+
app_key: string;
|
|
703
712
|
}
|
|
704
713
|
interface TemplaticalConfig {
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
714
|
+
container: string | HTMLElement;
|
|
715
|
+
auth: Omit<AuthConfig, "onError">;
|
|
716
|
+
baseUrl?: string;
|
|
717
|
+
theme?: ThemeOverrides;
|
|
718
|
+
locale?: string;
|
|
719
|
+
ai?: AiConfig | false;
|
|
720
|
+
onCreate?: (template: Template) => void;
|
|
721
|
+
onLoad?: (template: Template) => void;
|
|
722
|
+
onSave?: (result: SaveResult) => void;
|
|
723
|
+
onError?: (error: Error) => void;
|
|
724
|
+
onUnmount?: () => void;
|
|
725
|
+
mergeTags?: MergeTagsConfig;
|
|
726
|
+
onRequestMedia?: (context: MediaRequestContext) => Promise<MediaItem | null>;
|
|
727
|
+
displayConditions?: DisplayConditionsConfig;
|
|
728
|
+
fonts?: FontsConfig;
|
|
729
|
+
autoSave?: boolean;
|
|
730
|
+
autoSaveDebounce?: number;
|
|
731
|
+
onBeforeTestEmail?: (html: string) => string | Promise<string>;
|
|
732
|
+
customBlocks?: CustomBlockDefinition[];
|
|
733
|
+
commenting?: boolean;
|
|
734
|
+
onComment?: (event: CommentEvent) => void;
|
|
735
|
+
mcp?: McpConfig;
|
|
736
|
+
collaboration?: CollaborationConfig;
|
|
737
|
+
modules?: boolean;
|
|
729
738
|
}
|
|
730
739
|
interface TemplaticalInstance {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
740
|
+
setTheme(theme: ThemeOverrides): void;
|
|
741
|
+
create(content?: TemplateContent): Promise<Template>;
|
|
742
|
+
load(templateId: string): Promise<Template>;
|
|
743
|
+
save(): Promise<SaveResult>;
|
|
744
|
+
unmount(): void;
|
|
736
745
|
}
|
|
737
746
|
interface EditorState {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
747
|
+
template: Template | null;
|
|
748
|
+
content: TemplateContent;
|
|
749
|
+
selectedBlockId: string | null;
|
|
750
|
+
viewport: ViewportSize;
|
|
751
|
+
darkMode: boolean;
|
|
752
|
+
previewMode: boolean;
|
|
753
|
+
isDirty: boolean;
|
|
754
|
+
isSaving: boolean;
|
|
755
|
+
isLoading: boolean;
|
|
756
|
+
uiTheme: UiTheme;
|
|
748
757
|
}
|
|
749
758
|
interface ApiResponse<T> {
|
|
750
|
-
|
|
759
|
+
data: T;
|
|
751
760
|
}
|
|
752
761
|
interface ApiError {
|
|
753
|
-
|
|
754
|
-
|
|
762
|
+
message: string;
|
|
763
|
+
errors?: Record<string, string[]>;
|
|
755
764
|
}
|
|
756
765
|
interface PlanFeatures {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
766
|
+
media_folders: boolean;
|
|
767
|
+
import_from_url: boolean;
|
|
768
|
+
auto_save: boolean;
|
|
769
|
+
custom_fonts: boolean;
|
|
770
|
+
theme_customization: boolean;
|
|
771
|
+
html_block: boolean;
|
|
772
|
+
export_mjml: boolean;
|
|
773
|
+
white_label: boolean;
|
|
774
|
+
test_email: boolean;
|
|
775
|
+
ai_generation: boolean;
|
|
776
|
+
custom_blocks: boolean;
|
|
777
|
+
commenting: boolean;
|
|
778
|
+
collaboration: boolean;
|
|
779
|
+
saved_modules: boolean;
|
|
780
|
+
headless_sdk: boolean;
|
|
781
|
+
pluggable_media: boolean;
|
|
773
782
|
}
|
|
774
783
|
interface PlanLimits {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
784
|
+
max_file_size_mb: number;
|
|
785
|
+
max_templates: number | null;
|
|
786
|
+
media_categories: string[];
|
|
787
|
+
storage_limit_bytes: number;
|
|
779
788
|
}
|
|
780
789
|
interface PlanConfig {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
790
|
+
features: PlanFeatures;
|
|
791
|
+
limits: PlanLimits;
|
|
792
|
+
template_count: number;
|
|
793
|
+
plan: string;
|
|
794
|
+
media: MediaConfig;
|
|
795
|
+
storage: StorageInfo;
|
|
796
|
+
websocket: WebSocketServerConfig;
|
|
797
|
+
accessibility?: {
|
|
798
|
+
blockOnError?: boolean;
|
|
799
|
+
};
|
|
791
800
|
}
|
|
792
801
|
interface AiChatMessage {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
802
|
+
id: string;
|
|
803
|
+
role: "user" | "assistant";
|
|
804
|
+
content: string;
|
|
805
|
+
timestamp: number;
|
|
797
806
|
}
|
|
798
807
|
interface CreateCommentData {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
808
|
+
body: string;
|
|
809
|
+
blockId?: string;
|
|
810
|
+
parentId?: string;
|
|
811
|
+
authorIdentifier: string;
|
|
812
|
+
authorName: string;
|
|
804
813
|
}
|
|
805
814
|
interface UpdateCommentData {
|
|
806
|
-
|
|
815
|
+
body: string;
|
|
807
816
|
}
|
|
808
817
|
interface AiGenerateOptions {
|
|
809
|
-
|
|
818
|
+
conversationId?: string;
|
|
810
819
|
}
|
|
811
820
|
interface AiStreamEvent {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
821
|
+
type: "text" | "done" | "error";
|
|
822
|
+
text?: string;
|
|
823
|
+
content?: TemplateContent;
|
|
824
|
+
conversationId?: string;
|
|
825
|
+
error?: string;
|
|
817
826
|
}
|
|
818
827
|
interface RewriteData {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
828
|
+
text: string;
|
|
829
|
+
instruction: string;
|
|
830
|
+
blockId: string;
|
|
822
831
|
}
|
|
823
832
|
interface AiScoreOptions {
|
|
824
|
-
|
|
833
|
+
fixFindingId?: string;
|
|
825
834
|
}
|
|
826
|
-
|
|
835
|
+
//#endregion
|
|
827
836
|
export { type AiChatMessage, type AiConfig, type AiGenerateOptions, type AiScoreOptions, type AiStreamEvent, type ApiError, type ApiResponse, type AuthConfig, type AuthRequestOptions, BUTTON_BLOCK_DEFAULTS, type BaseBlock, type Block, type BlockDefaults, type BlockStyles, type BlockType, type BlockVisibility, type ButtonBlock, COUNTDOWN_BLOCK_DEFAULTS, type CategoryScore, type CollaborationConfig, type Collaborator, type ColumnLayout, type Comment, type CommentEvent, type CommentEventType, type CommentThread, type CountdownBlock, type CreateCommentData, type CustomBlock, type CustomBlockBooleanField, type CustomBlockColorField, type CustomBlockDefinition, type CustomBlockField, type CustomBlockFieldBase, type CustomBlockFieldType, type CustomBlockImageField, type CustomBlockNumberField, type CustomBlockRepeatableField, type CustomBlockSelectField, type CustomBlockTextField, type CustomBlockTextareaField, type CustomFont, DEFAULT_BLOCK_DEFAULTS, DEFAULT_TEMPLATE_DEFAULTS, DIVIDER_BLOCK_DEFAULTS, type DataSourceConfig, type DataSourceFetchContext, type DirectAuthConfig, type DisplayCondition, type DisplayConditionsConfig, type DividerBlock, type EditorState, EventEmitter, type ExportResult, type FindingSeverity, type FontsConfig, HEADING_LEVEL_FONT_SIZE, HTML_BLOCK_DEFAULTS, type HeadingLevel, type HealthCheckResult, type HtmlBlock, IMAGE_BLOCK_DEFAULTS, type ImageBlock, MENU_BLOCK_DEFAULTS, type McpConfig, type McpOperation, type McpOperationPayload, type MediaResult, type MenuBlock, type MenuItemData, type MergeTag, type MergeTagsConfig, PARAGRAPH_BLOCK_DEFAULTS, type ParagraphBlock, type PlanConfig, type PlanFeatures, type PlanLimits, type ProxyAuthConfig, type RewriteData, SECTION_BLOCK_DEFAULTS, SOCIAL_ICONS_BLOCK_DEFAULTS, SPACER_BLOCK_DEFAULTS, SYNTAX_PRESETS, type SaveResult, type SavedModule, type ScoringCategory, type ScoringFinding, type ScoringResult, type SdkAuthConfig, SdkError, type SectionBlock, type SelectOption, type SocialIcon, type SocialIconSize, type SocialIconStyle, type SocialIconsBlock, type SocialPlatform, type SpacerBlock, type SpacingValue, type SyntaxPreset, type SyntaxPresetName, TABLE_BLOCK_DEFAULTS, TITLE_BLOCK_DEFAULTS, type TableBlock, type TableCellData, type TableRowData, type Template, type TemplateContent, type TemplateDefaults, type TemplateSettings, type TemplateSnapshot, type TemplaticalConfig, type TemplaticalInstance, type TestEmailConfig, type ThemeOverrides, type TitleBlock, type TokenData, type UiTheme, type UpdateCommentData, type UserConfig, VIDEO_BLOCK_DEFAULTS, type VideoBlock, type ViewportSize, type WebSocketServerConfig, cloneBlock, containsMergeTag, createBlock, createButtonBlock, createCountdownBlock, createCustomBlock, createDefaultTemplateContent, createDividerBlock, createHtmlBlock, createImageBlock, createMenuBlock, createParagraphBlock, createSectionBlock, createSocialIconsBlock, createSpacerBlock, createTableBlock, createTitleBlock, createVideoBlock, deepMergeDefaults, generateId, getLogicMergeTagKeyword, getMergeTagLabel, getSyntaxTriggerChar, isButton, isCountdown, isCustomBlock, isDivider, isHtml, isImage, isLogicMergeTagValue, isMenu, isMergeTagValue, isParagraph, isSection, isSocialIcons, isSpacer, isTable, isTitle, isVideo, resolveHtmlLogicMergeTagLabels, resolveHtmlMergeTagLabels, resolveSyntax, restoreMergeTagMarkup };
|
|
837
|
+
//# sourceMappingURL=index.d.ts.map
|