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