@templatical/types 0.10.0 → 0.10.2
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 +587 -557
- package/dist/index.js +478 -579
- package/dist/index.js.map +1 -1
- package/package.json +4 -5
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,137 @@ 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/clone.d.ts
|
|
390
|
+
/**
|
|
391
|
+
* Cycle-safe deep clone via a JSON round-trip.
|
|
392
|
+
*
|
|
393
|
+
* A naked `JSON.stringify` throws `Converting circular structure to JSON`
|
|
394
|
+
* if the tree is self-referencing — e.g. a DOM element carrying a Sortable
|
|
395
|
+
* expando back-ref (`HTMLDivElement.SortableXXX -> instance -> el -> div`)
|
|
396
|
+
* leaks into block data through a drag handler inside a section. Both the
|
|
397
|
+
* editor's public `getContent()` export path and the history snapshot path
|
|
398
|
+
* must tolerate that: we drop the offending back-ref from the clone rather
|
|
399
|
+
* than throw. Losing a transient DOM expando is harmless; the block data is
|
|
400
|
+
* intact.
|
|
401
|
+
*
|
|
402
|
+
* The `WeakSet` replacer omits any object already seen on the current path,
|
|
403
|
+
* which covers every cyclic shape. Template content is tree-shaped (and is
|
|
404
|
+
* serialized to JSON for storage anyway), so dropping repeated references
|
|
405
|
+
* never costs real data.
|
|
406
|
+
*/
|
|
407
|
+
declare function safeClone<T>(value: T): T;
|
|
408
|
+
//#endregion
|
|
409
|
+
//#region src/config.d.ts
|
|
384
410
|
type ViewportSize = "desktop" | "mobile";
|
|
385
411
|
type UiTheme = "light" | "dark" | "auto";
|
|
386
412
|
interface CustomFont {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
413
|
+
name: string;
|
|
414
|
+
url: string;
|
|
415
|
+
fallback?: string;
|
|
390
416
|
}
|
|
391
417
|
interface FontsConfig {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
418
|
+
defaultFallback?: string;
|
|
419
|
+
defaultFont?: string;
|
|
420
|
+
customFonts?: CustomFont[];
|
|
395
421
|
}
|
|
396
422
|
interface ExportResult {
|
|
397
|
-
|
|
398
|
-
|
|
423
|
+
html: string;
|
|
424
|
+
mjml: string;
|
|
399
425
|
}
|
|
400
426
|
interface MergeTag {
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
427
|
+
label: string;
|
|
428
|
+
value: string;
|
|
429
|
+
/**
|
|
430
|
+
* Optional grouping label used by the built-in merge tag picker to
|
|
431
|
+
* section the list. When no tag in the configured array carries
|
|
432
|
+
* `group`, the picker renders a plain flat list with no headers.
|
|
433
|
+
* Ignored by the renderer and by typing-autocomplete.
|
|
434
|
+
*/
|
|
435
|
+
group?: string;
|
|
436
|
+
/**
|
|
437
|
+
* Optional helper text shown beneath the tag in the built-in merge
|
|
438
|
+
* tag picker. Not rendered anywhere else (toolbar, autocomplete,
|
|
439
|
+
* MJML output) and not stored on the inserted document node.
|
|
440
|
+
*/
|
|
441
|
+
description?: string;
|
|
416
442
|
}
|
|
417
443
|
interface MediaResult {
|
|
418
|
-
|
|
419
|
-
|
|
444
|
+
url: string;
|
|
445
|
+
alt?: string;
|
|
420
446
|
}
|
|
421
447
|
interface MergeTagsConfig {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
448
|
+
syntax?: SyntaxPresetName | SyntaxPreset;
|
|
449
|
+
tags?: MergeTag[];
|
|
450
|
+
onRequest?: () => Promise<MergeTag | null>;
|
|
451
|
+
/**
|
|
452
|
+
* Enables typing-based autocomplete in rich text fields. When the user
|
|
453
|
+
* types the syntax opener (e.g. `{{`), a popup lists matching `tags`.
|
|
454
|
+
*
|
|
455
|
+
* Defaults to `true`. Effective only when `tags` is non-empty AND
|
|
456
|
+
* `syntax` matches a built-in preset (custom regex syntaxes cannot be
|
|
457
|
+
* mapped to a trigger string and silently disable autocomplete).
|
|
458
|
+
*/
|
|
459
|
+
autocomplete?: boolean;
|
|
434
460
|
}
|
|
435
461
|
interface DisplayCondition {
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
462
|
+
label: string;
|
|
463
|
+
before: string;
|
|
464
|
+
after: string;
|
|
465
|
+
group?: string;
|
|
466
|
+
description?: string;
|
|
441
467
|
}
|
|
442
468
|
interface DisplayConditionsConfig {
|
|
443
|
-
|
|
444
|
-
|
|
469
|
+
conditions: DisplayCondition[];
|
|
470
|
+
allowCustom?: boolean;
|
|
445
471
|
}
|
|
446
472
|
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
|
-
|
|
473
|
+
bg?: string;
|
|
474
|
+
bgElevated?: string;
|
|
475
|
+
bgHover?: string;
|
|
476
|
+
bgActive?: string;
|
|
477
|
+
border?: string;
|
|
478
|
+
borderLight?: string;
|
|
479
|
+
text?: string;
|
|
480
|
+
textMuted?: string;
|
|
481
|
+
textDim?: string;
|
|
482
|
+
primary?: string;
|
|
483
|
+
primaryHover?: string;
|
|
484
|
+
primaryLight?: string;
|
|
485
|
+
secondary?: string;
|
|
486
|
+
secondaryHover?: string;
|
|
487
|
+
secondaryLight?: string;
|
|
488
|
+
success?: string;
|
|
489
|
+
successLight?: string;
|
|
490
|
+
warning?: string;
|
|
491
|
+
warningLight?: string;
|
|
492
|
+
danger?: string;
|
|
493
|
+
dangerLight?: string;
|
|
494
|
+
canvasBg?: string;
|
|
495
|
+
dark?: Omit<ThemeOverrides, "dark">;
|
|
470
496
|
}
|
|
471
497
|
declare class SdkError extends Error {
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
}
|
|
478
|
-
|
|
498
|
+
readonly statusCode?: number | undefined;
|
|
499
|
+
constructor(message: string, statusCode?: number | undefined);
|
|
500
|
+
get isNotFound(): boolean;
|
|
501
|
+
get isUnauthorized(): boolean;
|
|
502
|
+
get isServerError(): boolean;
|
|
503
|
+
}
|
|
504
|
+
//#endregion
|
|
505
|
+
//#region src/merge-tags.d.ts
|
|
479
506
|
interface SyntaxPreset {
|
|
480
|
-
|
|
481
|
-
|
|
507
|
+
value: RegExp;
|
|
508
|
+
logic: RegExp;
|
|
482
509
|
}
|
|
483
510
|
type SyntaxPresetName = "liquid" | "handlebars" | "mailchimp" | "ampscript";
|
|
484
511
|
declare const SYNTAX_PRESETS: Record<SyntaxPresetName, SyntaxPreset>;
|
|
@@ -497,331 +524,334 @@ declare function restoreMergeTagMarkup(html: string, mergeTags: MergeTag[], synt
|
|
|
497
524
|
declare function isLogicMergeTagValue(value: string, syntax: SyntaxPreset): boolean;
|
|
498
525
|
declare function getLogicMergeTagKeyword(value: string, syntax: SyntaxPreset): string;
|
|
499
526
|
declare function resolveHtmlLogicMergeTagLabels(html: string, syntax: SyntaxPreset): string;
|
|
500
|
-
|
|
527
|
+
//#endregion
|
|
528
|
+
//#region ../media-library/src/types.d.ts
|
|
501
529
|
type MediaCategory = "images" | "documents" | "videos" | "audio";
|
|
502
530
|
interface MediaItem {
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
531
|
+
id: string;
|
|
532
|
+
filename: string;
|
|
533
|
+
mime_type: string;
|
|
534
|
+
size: number;
|
|
535
|
+
url: string;
|
|
536
|
+
small_url: string | null;
|
|
537
|
+
medium_url: string | null;
|
|
538
|
+
large_url: string | null;
|
|
539
|
+
folder_id: string | null;
|
|
540
|
+
conversions_generated: boolean;
|
|
541
|
+
width: number | null;
|
|
542
|
+
height: number | null;
|
|
543
|
+
alt_text: string;
|
|
544
|
+
created_at: string;
|
|
545
|
+
updated_at: string;
|
|
518
546
|
}
|
|
519
547
|
interface MediaRequestContext {
|
|
520
|
-
|
|
548
|
+
accept?: MediaCategory[];
|
|
521
549
|
}
|
|
522
550
|
interface StorageInfo {
|
|
523
|
-
|
|
524
|
-
|
|
551
|
+
used_bytes: number;
|
|
552
|
+
limit_bytes: number;
|
|
525
553
|
}
|
|
526
554
|
interface MediaCategoryData {
|
|
527
|
-
|
|
528
|
-
|
|
555
|
+
mime_types: string[];
|
|
556
|
+
extensions: string[];
|
|
529
557
|
}
|
|
530
558
|
interface MediaConfig {
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
559
|
+
use_media_library: boolean;
|
|
560
|
+
categories: Record<string, MediaCategoryData>;
|
|
561
|
+
max_file_size: number;
|
|
534
562
|
}
|
|
535
|
-
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/cloud.d.ts
|
|
536
565
|
interface Template {
|
|
537
|
-
|
|
538
|
-
|
|
566
|
+
id: string;
|
|
567
|
+
content: TemplateContent;
|
|
539
568
|
}
|
|
540
569
|
interface TemplateSnapshot {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
570
|
+
id: string;
|
|
571
|
+
template_id: string;
|
|
572
|
+
content: TemplateContent;
|
|
573
|
+
is_autosave: boolean;
|
|
574
|
+
created_at: string;
|
|
546
575
|
}
|
|
547
576
|
interface Comment {
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
577
|
+
id: string;
|
|
578
|
+
template_id: string;
|
|
579
|
+
block_id: string | null;
|
|
580
|
+
parent_id: string | null;
|
|
581
|
+
body: string;
|
|
582
|
+
author_identifier: string;
|
|
583
|
+
author_name: string;
|
|
584
|
+
resolved_at: string | null;
|
|
585
|
+
resolved_by_identifier: string | null;
|
|
586
|
+
resolved_by_name: string | null;
|
|
587
|
+
created_at: string;
|
|
588
|
+
updated_at: string;
|
|
589
|
+
replies: Comment[];
|
|
561
590
|
}
|
|
562
591
|
type CommentThread = Comment;
|
|
563
592
|
type CommentEventType = "created" | "updated" | "deleted" | "resolved" | "unresolved";
|
|
564
593
|
interface CommentEvent {
|
|
565
|
-
|
|
566
|
-
|
|
594
|
+
type: CommentEventType;
|
|
595
|
+
comment: Comment;
|
|
567
596
|
}
|
|
568
597
|
interface SavedModule {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
598
|
+
id: string;
|
|
599
|
+
name: string;
|
|
600
|
+
content: Block[];
|
|
601
|
+
created_at: string;
|
|
602
|
+
updated_at: string;
|
|
574
603
|
}
|
|
575
604
|
type FindingSeverity = "high" | "medium" | "low";
|
|
576
605
|
type ScoringCategory = "spam" | "readability" | "accessibility" | "bestPractices";
|
|
577
606
|
interface ScoringFinding {
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
607
|
+
id: string;
|
|
608
|
+
severity: FindingSeverity;
|
|
609
|
+
message: string;
|
|
610
|
+
blockId: string | null;
|
|
611
|
+
category: ScoringCategory;
|
|
612
|
+
suggestion: string;
|
|
584
613
|
}
|
|
585
614
|
interface CategoryScore {
|
|
586
|
-
|
|
587
|
-
|
|
615
|
+
score: number;
|
|
616
|
+
findings: ScoringFinding[];
|
|
588
617
|
}
|
|
589
618
|
interface ScoringResult {
|
|
590
|
-
|
|
591
|
-
|
|
619
|
+
score: number;
|
|
620
|
+
categories: Record<ScoringCategory, CategoryScore>;
|
|
592
621
|
}
|
|
593
622
|
interface HealthCheckResult {
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
623
|
+
api: {
|
|
624
|
+
ok: boolean;
|
|
625
|
+
latency: number;
|
|
626
|
+
};
|
|
627
|
+
websocket: {
|
|
628
|
+
ok: boolean;
|
|
629
|
+
error?: string;
|
|
630
|
+
};
|
|
631
|
+
auth: {
|
|
632
|
+
ok: boolean;
|
|
633
|
+
error?: string;
|
|
634
|
+
};
|
|
635
|
+
overall: boolean;
|
|
607
636
|
}
|
|
608
637
|
interface TokenData {
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
638
|
+
token: string;
|
|
639
|
+
expires_at: number;
|
|
640
|
+
project_id: string;
|
|
641
|
+
tenant: string;
|
|
642
|
+
test_email?: {
|
|
643
|
+
allowed_emails: string[];
|
|
644
|
+
signature: string;
|
|
645
|
+
};
|
|
646
|
+
user?: {
|
|
647
|
+
id: string;
|
|
648
|
+
name: string;
|
|
649
|
+
signature: string;
|
|
650
|
+
};
|
|
622
651
|
}
|
|
623
652
|
interface AuthRequestOptions {
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
653
|
+
method?: "GET" | "POST";
|
|
654
|
+
headers?: Record<string, string>;
|
|
655
|
+
body?: Record<string, unknown>;
|
|
656
|
+
credentials?: RequestCredentials;
|
|
628
657
|
}
|
|
629
658
|
interface AuthConfig {
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
659
|
+
url: string;
|
|
660
|
+
baseUrl?: string;
|
|
661
|
+
requestOptions?: AuthRequestOptions;
|
|
662
|
+
onError?: (error: Error) => void;
|
|
634
663
|
}
|
|
635
664
|
interface TestEmailConfig {
|
|
636
|
-
|
|
637
|
-
|
|
665
|
+
allowedEmails: string[];
|
|
666
|
+
signature: string;
|
|
638
667
|
}
|
|
639
668
|
interface UserConfig {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
669
|
+
id: string;
|
|
670
|
+
name: string;
|
|
671
|
+
signature: string;
|
|
643
672
|
}
|
|
644
673
|
interface DirectAuthConfig {
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
674
|
+
mode: "direct";
|
|
675
|
+
clientId: string;
|
|
676
|
+
clientSecret: string;
|
|
677
|
+
tenant: string;
|
|
678
|
+
baseUrl?: string;
|
|
650
679
|
}
|
|
651
680
|
interface ProxyAuthConfig {
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
681
|
+
mode: "proxy";
|
|
682
|
+
url: string;
|
|
683
|
+
baseUrl?: string;
|
|
684
|
+
requestOptions?: AuthRequestOptions;
|
|
656
685
|
}
|
|
657
686
|
type SdkAuthConfig = DirectAuthConfig | ProxyAuthConfig;
|
|
658
687
|
interface Collaborator {
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
688
|
+
id: string;
|
|
689
|
+
name: string;
|
|
690
|
+
color: string;
|
|
691
|
+
selectedBlockId: string | null;
|
|
663
692
|
}
|
|
664
693
|
type McpOperation = "add_block" | "update_block" | "delete_block" | "move_block" | "update_settings" | "set_content" | "update_block_style";
|
|
665
694
|
interface McpOperationPayload {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
695
|
+
operation: McpOperation;
|
|
696
|
+
data: Record<string, unknown>;
|
|
697
|
+
timestamp: number;
|
|
669
698
|
}
|
|
670
699
|
interface SaveResult {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
700
|
+
templateId: string;
|
|
701
|
+
html: string;
|
|
702
|
+
mjml: string;
|
|
703
|
+
content: TemplateContent;
|
|
675
704
|
}
|
|
676
705
|
interface AiConfig {
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
706
|
+
chat?: boolean;
|
|
707
|
+
scoring?: boolean;
|
|
708
|
+
designToTemplate?: boolean;
|
|
709
|
+
rewrite?: boolean;
|
|
681
710
|
}
|
|
682
711
|
interface McpConfig {
|
|
683
|
-
|
|
684
|
-
|
|
712
|
+
enabled: boolean;
|
|
713
|
+
onOperation?: (payload: McpOperationPayload) => void;
|
|
685
714
|
}
|
|
686
715
|
interface CollaborationConfig {
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
716
|
+
enabled: boolean;
|
|
717
|
+
onCollaboratorJoined?: (collaborator: Collaborator) => void;
|
|
718
|
+
onCollaboratorLeft?: (collaborator: Collaborator) => void;
|
|
719
|
+
onBlockLocked?: (event: {
|
|
720
|
+
blockId: string;
|
|
721
|
+
collaborator: Collaborator;
|
|
722
|
+
}) => void;
|
|
723
|
+
onBlockUnlocked?: (event: {
|
|
724
|
+
blockId: string;
|
|
725
|
+
collaborator: Collaborator;
|
|
726
|
+
}) => void;
|
|
698
727
|
}
|
|
699
728
|
interface WebSocketServerConfig {
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
729
|
+
host: string;
|
|
730
|
+
port: number;
|
|
731
|
+
app_key: string;
|
|
703
732
|
}
|
|
704
733
|
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
|
-
|
|
734
|
+
container: string | HTMLElement;
|
|
735
|
+
auth: Omit<AuthConfig, "onError">;
|
|
736
|
+
baseUrl?: string;
|
|
737
|
+
theme?: ThemeOverrides;
|
|
738
|
+
locale?: string;
|
|
739
|
+
ai?: AiConfig | false;
|
|
740
|
+
onCreate?: (template: Template) => void;
|
|
741
|
+
onLoad?: (template: Template) => void;
|
|
742
|
+
onSave?: (result: SaveResult) => void;
|
|
743
|
+
onError?: (error: Error) => void;
|
|
744
|
+
onUnmount?: () => void;
|
|
745
|
+
mergeTags?: MergeTagsConfig;
|
|
746
|
+
onRequestMedia?: (context: MediaRequestContext) => Promise<MediaItem | null>;
|
|
747
|
+
displayConditions?: DisplayConditionsConfig;
|
|
748
|
+
fonts?: FontsConfig;
|
|
749
|
+
autoSave?: boolean;
|
|
750
|
+
autoSaveDebounce?: number;
|
|
751
|
+
onBeforeTestEmail?: (html: string) => string | Promise<string>;
|
|
752
|
+
customBlocks?: CustomBlockDefinition[];
|
|
753
|
+
commenting?: boolean;
|
|
754
|
+
onComment?: (event: CommentEvent) => void;
|
|
755
|
+
mcp?: McpConfig;
|
|
756
|
+
collaboration?: CollaborationConfig;
|
|
757
|
+
modules?: boolean;
|
|
729
758
|
}
|
|
730
759
|
interface TemplaticalInstance {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
760
|
+
setTheme(theme: ThemeOverrides): void;
|
|
761
|
+
create(content?: TemplateContent): Promise<Template>;
|
|
762
|
+
load(templateId: string): Promise<Template>;
|
|
763
|
+
save(): Promise<SaveResult>;
|
|
764
|
+
unmount(): void;
|
|
736
765
|
}
|
|
737
766
|
interface EditorState {
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
767
|
+
template: Template | null;
|
|
768
|
+
content: TemplateContent;
|
|
769
|
+
selectedBlockId: string | null;
|
|
770
|
+
viewport: ViewportSize;
|
|
771
|
+
darkMode: boolean;
|
|
772
|
+
previewMode: boolean;
|
|
773
|
+
isDirty: boolean;
|
|
774
|
+
isSaving: boolean;
|
|
775
|
+
isLoading: boolean;
|
|
776
|
+
uiTheme: UiTheme;
|
|
748
777
|
}
|
|
749
778
|
interface ApiResponse<T> {
|
|
750
|
-
|
|
779
|
+
data: T;
|
|
751
780
|
}
|
|
752
781
|
interface ApiError {
|
|
753
|
-
|
|
754
|
-
|
|
782
|
+
message: string;
|
|
783
|
+
errors?: Record<string, string[]>;
|
|
755
784
|
}
|
|
756
785
|
interface PlanFeatures {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
786
|
+
media_folders: boolean;
|
|
787
|
+
import_from_url: boolean;
|
|
788
|
+
auto_save: boolean;
|
|
789
|
+
custom_fonts: boolean;
|
|
790
|
+
theme_customization: boolean;
|
|
791
|
+
html_block: boolean;
|
|
792
|
+
export_mjml: boolean;
|
|
793
|
+
white_label: boolean;
|
|
794
|
+
test_email: boolean;
|
|
795
|
+
ai_generation: boolean;
|
|
796
|
+
custom_blocks: boolean;
|
|
797
|
+
commenting: boolean;
|
|
798
|
+
collaboration: boolean;
|
|
799
|
+
saved_modules: boolean;
|
|
800
|
+
headless_sdk: boolean;
|
|
801
|
+
pluggable_media: boolean;
|
|
773
802
|
}
|
|
774
803
|
interface PlanLimits {
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
804
|
+
max_file_size_mb: number;
|
|
805
|
+
max_templates: number | null;
|
|
806
|
+
media_categories: string[];
|
|
807
|
+
storage_limit_bytes: number;
|
|
779
808
|
}
|
|
780
809
|
interface PlanConfig {
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
810
|
+
features: PlanFeatures;
|
|
811
|
+
limits: PlanLimits;
|
|
812
|
+
template_count: number;
|
|
813
|
+
plan: string;
|
|
814
|
+
media: MediaConfig;
|
|
815
|
+
storage: StorageInfo;
|
|
816
|
+
websocket: WebSocketServerConfig;
|
|
817
|
+
accessibility?: {
|
|
818
|
+
blockOnError?: boolean;
|
|
819
|
+
};
|
|
791
820
|
}
|
|
792
821
|
interface AiChatMessage {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
822
|
+
id: string;
|
|
823
|
+
role: "user" | "assistant";
|
|
824
|
+
content: string;
|
|
825
|
+
timestamp: number;
|
|
797
826
|
}
|
|
798
827
|
interface CreateCommentData {
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
828
|
+
body: string;
|
|
829
|
+
blockId?: string;
|
|
830
|
+
parentId?: string;
|
|
831
|
+
authorIdentifier: string;
|
|
832
|
+
authorName: string;
|
|
804
833
|
}
|
|
805
834
|
interface UpdateCommentData {
|
|
806
|
-
|
|
835
|
+
body: string;
|
|
807
836
|
}
|
|
808
837
|
interface AiGenerateOptions {
|
|
809
|
-
|
|
838
|
+
conversationId?: string;
|
|
810
839
|
}
|
|
811
840
|
interface AiStreamEvent {
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
841
|
+
type: "text" | "done" | "error";
|
|
842
|
+
text?: string;
|
|
843
|
+
content?: TemplateContent;
|
|
844
|
+
conversationId?: string;
|
|
845
|
+
error?: string;
|
|
817
846
|
}
|
|
818
847
|
interface RewriteData {
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
848
|
+
text: string;
|
|
849
|
+
instruction: string;
|
|
850
|
+
blockId: string;
|
|
822
851
|
}
|
|
823
852
|
interface AiScoreOptions {
|
|
824
|
-
|
|
853
|
+
fixFindingId?: string;
|
|
825
854
|
}
|
|
826
|
-
|
|
827
|
-
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 };
|
|
855
|
+
//#endregion
|
|
856
|
+
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, safeClone };
|
|
857
|
+
//# sourceMappingURL=index.d.ts.map
|