@emailmaker/emailmaker 1.0.92 → 1.0.93-alpha.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.
@@ -0,0 +1,1553 @@
1
+ type MayBePromise<T> = T | Promise<T>;
2
+ type PromiseWrap<T> = Promise<Awaited<T>>;
3
+ type RecursivePartial<T> = {
4
+ [K in keyof T]?: T[K] extends number | string | boolean | bigint ? T[K] : RecursivePartial<T[K]>;
5
+ };
6
+ type AppListener<Value, Result = void> = (value: Value) => MayBePromise<Result>;
7
+ type AppEvent<Listener extends AppListener<any, any>> = (
8
+ listener: Listener,
9
+ priority?: number,
10
+ thisArg?: any,
11
+ ) => () => void;
12
+
13
+ // type UploadEventPayload = { file: File; file_url: string };
14
+ // type UploadListener<Cancelable = true> = Listener<UploadEventPayload, Cancelable>;
15
+ // type UploadEvent<Cancelable = true> = AppEvent<UploadEventPayload, Cancelable>;
16
+
17
+ type SaveEventPayload<T> = {
18
+ /** source of the event */
19
+ source?: string;
20
+ /** previous value */
21
+ prev?: T;
22
+ /** changed fields */
23
+ patch: Partial<T>;
24
+ /** next value */
25
+ value: T;
26
+ };
27
+
28
+ type CreateEventPayload<T> = {
29
+ /** source of the event */
30
+ source?: string;
31
+ /** next value */
32
+ value: T;
33
+ };
34
+
35
+ type RemoveEventPayload<T> = {
36
+ /** source of the event */
37
+ source?: string;
38
+ /** removed value */
39
+ value: T;
40
+ };
41
+
42
+ type MergeTagGroup = {
43
+ type?: 'group';
44
+ label: string;
45
+ value: string;
46
+ children?: MergeTag[];
47
+ };
48
+
49
+ type MergeTagItem = {
50
+ label: string;
51
+ value: string;
52
+ };
53
+ type MergeTag = MergeTagGroup | MergeTagItem;
54
+
55
+ type SaveListener<T> = AppListener<SaveEventPayload<T>, T | undefined | void>;
56
+ type SaveEvent<T> = AppEvent<SaveListener<T>>;
57
+ type RemoveListener<T> = AppListener<RemoveEventPayload<T>>;
58
+ type RemoveEvent<T> = AppEvent<RemoveListener<T>>;
59
+ type CreateListener<T> = AppListener<CreateEventPayload<T>, T | undefined | void>;
60
+ type CreateEvent<T> = AppEvent<CreateListener<T>>;
61
+
62
+ interface ParsedAMP {
63
+ code: string;
64
+ html: string;
65
+ ampHtml: string;
66
+ }
67
+ type Notify = {
68
+ type?: 'success' | 'info' | 'error' | 'warning';
69
+ message: string | HTMLElement;
70
+ description?: string | HTMLElement;
71
+ btn?: string | HTMLElement;
72
+ onClose?: () => void;
73
+ duration?: number | null;
74
+ icon?: string | HTMLElement;
75
+ placement?: 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
76
+ style?: any;
77
+ className?: string;
78
+ onClick?: () => void;
79
+ closeIcon?: boolean | string | HTMLElement;
80
+ props?: any;
81
+ role?: 'alert' | 'status';
82
+ };
83
+
84
+ type EmailDesc = {
85
+ id?: string;
86
+ title?: string;
87
+ code?: string;
88
+ subject?: string;
89
+ preheader?: string;
90
+ };
91
+
92
+ type BlockDesc = {
93
+ id?: string;
94
+ title?: string;
95
+ code?: string;
96
+ };
97
+
98
+ interface ISelection {
99
+ selectionStartLineNumber: number;
100
+ selectionStartColumn: number;
101
+ positionLineNumber: number;
102
+ positionColumn: number;
103
+ }
104
+ interface ISingleModelEditStackData {
105
+ afterCursorState: ISelection[];
106
+ afterVersionId: number;
107
+ beforeCursorState: ISelection[];
108
+ beforeVersionId: number;
109
+ changes: {
110
+ oldPosition: number;
111
+ oldText: string;
112
+ newPosition: number;
113
+ newText: string;
114
+ }[];
115
+ }
116
+
117
+ interface IFrameErrorInfo {
118
+ future: ISingleModelEditStackData[];
119
+ past: ISingleModelEditStackData[];
120
+ errorResolved: boolean;
121
+ message: string;
122
+ text: string;
123
+ stack: string;
124
+ userId: string;
125
+ entityId: string;
126
+ entityType: 'email' | 'block';
127
+ sentryEventId: string;
128
+ }
129
+
130
+ declare namespace Notify {
131
+ type Error = { innerException?: any } & (
132
+ | { id?: ''; data?: any }
133
+ | { id: 'EMAIL_CREATING_ERROR'; data: EmailDesc }
134
+ | { id: 'EMAIL_EDITING_ERROR'; data: EmailDesc }
135
+ | { id: 'FOLDER_CREATE_ERROR'; data: string }
136
+ | { id: 'EMAIL_CLONING_ERROR'; data: EmailDesc }
137
+ | { id: 'TAG_CREATING_ERROR'; data: string }
138
+ | { id: 'EMAIL_ACCESS_TO_LOCKED_ERROR'; data: EmailDesc }
139
+ | { id: 'EMAIL_TOO_MANY_TAGS_ERROR'; data: EmailDesc }
140
+ | { id: 'BLOCK_GET_ERROR'; data: {} }
141
+ | { id: 'BLOCK_ACCESS_TO_LOCKED_ERROR'; data: BlockDesc }
142
+ | { id: 'BLOCK_TOO_MANY_TAGS_ERROR'; data: BlockDesc }
143
+ | { id: 'BLOCK_CLONING_ERROR'; data: BlockDesc }
144
+ | { id: 'AI_IMAGE_SEND_ERROR'; data: any }
145
+ | { id: 'AI_IMAGE_GET_ERROR'; data: any }
146
+ | { id: 'IMAGE_UPLOAD_WRONG_FORMAT'; data: File }
147
+ | { id: 'IMAGE_UPLOAD_ERROR'; data: File }
148
+ | { id: 'BLOCK_CREATING_ERROR'; data: BlockDesc }
149
+ | { id: 'BLOCK_EDITING_ERROR'; data: BlockDesc }
150
+ | { id: 'EMAIL_AUTOSAVE_ERROR'; data: ExportedApi.EmailRevision }
151
+ | { id: 'EMAIL_INIT_EVENT_ERROR'; data: EmailDesc }
152
+ | { id: 'SAVE_BUTTON_CLICK_EVENT_ERROR'; data: EmailDesc }
153
+ | { id: 'NEXT_BUTTON_CLICK_EVENT_ERROR'; data: EmailDesc }
154
+ | { id: 'BLOCK_REMOVING_ERROR'; data: BlockDesc }
155
+ | { id: 'IFRAME_ERROR'; data: IFrameErrorInfo }
156
+ | { id: 'GET_LOCALE_ERROR'; data: any }
157
+ | { id: 'GET_LOCALES_ERROR'; data: any }
158
+ );
159
+ type ErrorEvent = {
160
+ type: 'error';
161
+ } & Error;
162
+
163
+ type Success =
164
+ | { id?: ''; data?: any }
165
+ | { id: 'EMAIL_TITLE_UPDATED_FROM_AI'; data: string }
166
+ | { id: 'EMAIL_PREHEADER_UPDATED_FROM_AI'; data: string }
167
+ | { id: 'TEXT_COPIED_TO_CLIPBOARD'; data: string }
168
+ | { id: 'EMAIL_SAVING_SUCCESS'; data: EmailDesc }
169
+ | { id: 'AI_IMAGE_SEND_SUCCESS'; data: any }
170
+ | { id: 'IMAGE_UPLOAD_SUCCESS'; data: File }
171
+ | { id: 'BLOCK_CREATING_SUCCESS'; data: BlockDesc }
172
+ | { id: 'BLOCK_EDITING_SUCCESS'; data: BlockDesc }
173
+ | { id: 'EMAIL_AUTOSAVE_SUCCESS'; data: ExportedApi.EmailRevision }
174
+ | { id: 'BLOCK_CLONING_SUCCESS'; data: BlockDesc }
175
+ | { id: 'BLOCK_REMOVING_SUCCESS'; data: BlockDesc };
176
+
177
+ type SuccessEvent = {
178
+ type: 'success';
179
+ } & Success;
180
+
181
+ type Warning =
182
+ | { id?: ''; data?: any }
183
+ | { id: 'COPY_NOT_SAVED_BLOCK'; data: ExportedApi.Block }
184
+ | { id: 'EMAIL_TITLE_UPDATED'; data: string };
185
+
186
+ type WarningEvent = { type: 'warning' } & Warning;
187
+
188
+ type Info = { id?: ''; data?: any };
189
+
190
+ type InfoEvent = { type: 'info' } & Info;
191
+ }
192
+
193
+ type NotifyEvent = Notify.SuccessEvent | Notify.ErrorEvent | Notify.WarningEvent | Notify.InfoEvent;
194
+
195
+ declare namespace ExportedApi {
196
+ interface Block {
197
+ /**
198
+ * Date of publication of the record (according to the time zone of the site).
199
+ * @format date-time
200
+ */
201
+ date?: string | null;
202
+ /**
203
+ * Date of publication of the record, GMT.
204
+ * @format date-time
205
+ */
206
+ date_gmt?: string | null;
207
+
208
+ /** The unique identifier of the record. */
209
+ id?: string;
210
+ /**
211
+ * The URL of the record.
212
+ * @format uri
213
+ */
214
+
215
+ modified?: string;
216
+ /**
217
+ * The date the record was last modified (in GMT format).
218
+ * @format date-time
219
+ */
220
+ modified_gmt?: string;
221
+ /** The name of the entry. */
222
+ title?: string;
223
+ /** ID of the author of the entry. */
224
+ author?: string;
225
+ /** An excerpt of the recording. */
226
+ excerpt?: string;
227
+
228
+ subject?: string;
229
+ description?: string;
230
+ code?: string;
231
+ project?: string | number;
232
+ related_email?: string;
233
+ type?: string;
234
+ }
235
+ }
236
+ declare namespace ExportedApi {
237
+ interface BlockRevision {
238
+ /** ID of the editorial board author. */
239
+ author?: string | number;
240
+ /**
241
+ * The date of publication of the record, according to the time zone of the site.
242
+ * @format date-time
243
+ */
244
+ date?: string;
245
+ /**
246
+ * The time of publication of the editorial office, GMT.
247
+ * @format date-time
248
+ */
249
+ date_gmt?: string;
250
+ /** The global unique identifier of the record. */
251
+ guid?: {
252
+ /** GUID to write in the form in which it exists in the database. */
253
+ raw?: string;
254
+ /** The GUID for the record, converted for display. */
255
+ rendered?: string;
256
+ };
257
+ /** Unique identifier of the editorial office. */
258
+ id?: string;
259
+ /**
260
+ * The date of the last revision, according to the time zone of the site.
261
+ * @format date-time
262
+ */
263
+ modified?: string;
264
+ /**
265
+ * Date of the last revision, GMT.
266
+ * @format date-time
267
+ */
268
+ modified_gmt?: string;
269
+ /** ID of the editorial parent. */
270
+ parent?: string;
271
+ /** The alphanumeric identifier of the record is unique for its type. */
272
+ slug?: string;
273
+ /** The name of the entry. */
274
+ title?: string;
275
+ /** An excerpt of the recording. */
276
+ excerpt?: string;
277
+ /**
278
+ * Link to preview the recording.
279
+ * @format uri
280
+ */
281
+ preview_link?: string;
282
+
283
+ code?: string;
284
+ }
285
+ }
286
+ declare namespace ExportedApi {
287
+ enum CodeErrorSeverity {
288
+ Hint = 1,
289
+ Info = 2,
290
+ Warning = 4,
291
+ Error = 8,
292
+ }
293
+
294
+ enum CodeErrorTag {
295
+ Unnecessary = 1,
296
+ Deprecated = 2,
297
+ }
298
+
299
+ interface CodeError {
300
+ severity: CodeErrorSeverity;
301
+ message: string;
302
+ source?: string;
303
+ startLineNumber: number;
304
+ startColumn: number;
305
+ endLineNumber: number;
306
+ endColumn: number;
307
+ startOffset: number;
308
+ endOffset: number;
309
+ tags?: CodeErrorTag[];
310
+ }
311
+ }
312
+
313
+ declare namespace ExportedApi {
314
+ interface Comment {
315
+ /** Unique identifier for the comment. */
316
+ id?: string;
317
+ /** User object ID, if the author is a user. */
318
+ author?: string;
319
+ /**
320
+ * The email address of the author of the comment.
321
+ * @format email
322
+ */
323
+ author_email?: string;
324
+ /**
325
+ * The IP address of the comment author.
326
+ * @format ip
327
+ */
328
+ author_ip?: string;
329
+ /** The display name of the comment author. */
330
+ author_name?: string;
331
+ /**
332
+ * URL for the author of the comment.
333
+ * @format uri
334
+ */
335
+ author_url?: string;
336
+ /** Value of the User-Agent of the comment author. */
337
+ author_user_agent?: string;
338
+ /** The content of the comment. */
339
+ content?: string;
340
+ /**
341
+ * Date of publication of the comment (according to the time zone of the site).
342
+ * @format date-time
343
+ */
344
+ date?: string;
345
+ /**
346
+ * The time of publication of the comment, GMT.
347
+ * @format date-time
348
+ */
349
+ date_gmt?: string;
350
+ /**
351
+ * ID of the associated record object.
352
+ * @default 0
353
+ */
354
+ post?: string;
355
+ /** Comment status. */
356
+ status?: string;
357
+ /** Comment type. */
358
+ type?: string;
359
+ /** URL of the comment author's avatar image. */
360
+ author_avatar_urls?: {
361
+ /**
362
+ * URL avatars with an image size of 24 pixels.
363
+ * @format uri
364
+ */
365
+ '24'?: string;
366
+ /**
367
+ * URL avatars with an image size of 48 pixels.
368
+ * @format uri
369
+ */
370
+ '48'?: string;
371
+ /**
372
+ * URL avatars with an image size of 96 pixels.
373
+ * @format uri
374
+ */
375
+ '96'?: string;
376
+ };
377
+ /** Meta fields. */
378
+ meta?: object;
379
+ target_id?: string;
380
+
381
+ parent?: string;
382
+ }
383
+ }
384
+ declare namespace ExportedApi {
385
+ type EditorOptions = {
386
+ fontSize?: number;
387
+ fontFamily?: string;
388
+ tabSize?: number;
389
+ wordWrap?: boolean;
390
+ minimap?: boolean;
391
+ insertSpaces?: boolean;
392
+ };
393
+ }
394
+ declare namespace ExportedApi {
395
+ interface Email {
396
+ /**
397
+ * Date of publication of the record, GMT.
398
+ * @format date-time
399
+ */
400
+ date_gmt?: string | null;
401
+ /** Unique identifier of the record. */
402
+ id?: string;
403
+ /** The name of the letter. */
404
+ title?: string;
405
+ /** Preheader of the letter. */
406
+ preheader?: string;
407
+ /** ID of the author of the entry. */
408
+ author?: string;
409
+ lock?: boolean;
410
+ subject?: string;
411
+ description?: string;
412
+ code?: string;
413
+ project?: string | number;
414
+ // email tag names
415
+ tags?: string[];
416
+ utm_parameters?: {
417
+ utm_source?: string;
418
+ utm_medium?: string;
419
+ utm_campaign?: string;
420
+ utm_term?: string;
421
+ utm_content?: string;
422
+ };
423
+ parent_email?: string;
424
+ common_styles?: string;
425
+ }
426
+
427
+ interface CompiledEmail extends Email {
428
+ readonly compiled: {
429
+ html: string;
430
+ ampHtml: string;
431
+ text: string;
432
+ };
433
+ }
434
+ }
435
+ declare namespace ExportedApi {
436
+ interface EmailRevision {
437
+ /** ID of the editorial board author. */
438
+ author?: string;
439
+ /**
440
+ * The date of publication of the record, according to the time zone of the site.
441
+ * @format date-time
442
+ */
443
+ date?: string;
444
+ /**
445
+ * The time of publication of the editorial office, GMT.
446
+ * @format date-time
447
+ */
448
+ date_gmt?: string;
449
+ /** Unique identifier of the editorial office. */
450
+ id?: string;
451
+ /**
452
+ * The date of the last revision, according to the time zone of the site.
453
+ * @format date-time
454
+ */
455
+ modified?: string;
456
+ /**
457
+ * Date of the last revision, GMT.
458
+ * @format date-time
459
+ */
460
+ modified_gmt?: string;
461
+ /** ID of the editorial parent. */
462
+ parent?: string;
463
+ /** The name of the entry. */
464
+ title?: string;
465
+ /** An excerpt of the recording. */
466
+ excerpt?: string;
467
+
468
+ code?: string;
469
+
470
+ preheader?: string;
471
+
472
+ subject?: string;
473
+
474
+ common_styles?: string;
475
+ }
476
+
477
+ interface CompiledEmailRevision extends EmailRevision {
478
+ readonly compiled: {
479
+ html: string;
480
+ ampHtml: string;
481
+ };
482
+ }
483
+ }
484
+ declare namespace ExportedApi {
485
+ export type ThemeConfig = any;
486
+ }
487
+ declare namespace ExportedApi {
488
+ export type CodeModeDirection = 'none' | 'left' | 'right' | 'bottom';
489
+ export type Locale = 'en_US' | 'ru_RU';
490
+ export type ConfigMods = 'pro' | 'editor' | 'simple' | 'freeUserBlocks';
491
+
492
+ export interface MergeTagsInfo {
493
+ syntax: string[];
494
+ items: MergeTag[];
495
+ }
496
+
497
+ type LimitName = 'AiImgCount' | 'AiChatCount' | 'AiGeneratorCount' | 'OptimizationCount';
498
+
499
+ type LocaleListener = AppListener<string, string>;
500
+ type LimitListener = AppListener<{ name: LimitName; count: number }>;
501
+
502
+ interface AdvancedConfigs {
503
+ [key: string]: Config;
504
+ }
505
+
506
+ interface Counters {
507
+ optimization_counter: number;
508
+ ai_counter: number;
509
+ ai_img_counter: number;
510
+ ai_generator_limit: number;
511
+ }
512
+
513
+ interface Limits {
514
+ optimization_limit: number;
515
+ ai_limit: number;
516
+ ai_img_limit: number;
517
+ ai_generator_limit: number;
518
+ }
519
+
520
+ interface Config {
521
+ /** Application mode */
522
+ mode?: ConfigMods;
523
+
524
+ /** Counters and limits */
525
+ counters?: Counters;
526
+ limits?: Limits;
527
+ /** billing page url */
528
+ billingPageUrl?: string;
529
+
530
+ imageInfoToolUrl?: string;
531
+ /** Application Styles */
532
+ styles: string;
533
+ /** Application theme */
534
+ theme: string;
535
+ /** Application theme settings */
536
+ themes: { [P in string]: ThemeConfig };
537
+ /** showing the back arrow */
538
+ headerArrowBackVisible: boolean;
539
+ /** display of the Subject field */
540
+ headerTitleVisible: boolean;
541
+ /** showing the Preheader field */
542
+ headerPreheaderVisible: boolean;
543
+ /** showing the Header field */
544
+ /** showing breadcrumbs in an iframe */
545
+ pathEnabled: boolean;
546
+ /** showing copy-paste of a block in an iframe */
547
+ copyPasteEnabled: boolean;
548
+ /** showing the Version History button */
549
+ historyEnabled: boolean;
550
+ /** showing the Code-mode button */
551
+ codeEnabled: boolean;
552
+ /** showing the Code-mode button in the mode when there is a desktop/mobile switch */
553
+ codeSideEnabled: boolean;
554
+ /** showing the Preview button */
555
+ previewIconEnabled: boolean;
556
+ /** Preview link */
557
+ previewModeEnabled: boolean;
558
+ /** showing the Test button in the mailers */
559
+ livePreviewEnabled: boolean;
560
+ /** showing the Send Test button */
561
+ sendTestEnabled: boolean;
562
+ /** showing the Share button */
563
+ sharePreviewEnabled: boolean;
564
+ /** displaying the message menu */
565
+ emailDropdownMenuEnabled: boolean;
566
+ /** showing the Clone item in the message menu */
567
+ emailDropdownMenuClone: boolean;
568
+ /** showing the Import item in the emails menu */
569
+ emailDropdownMenuImport: boolean;
570
+ /** showing the Import item in the emails menu like button */
571
+ emailDropdownMenuImportButton: boolean;
572
+ /** showing the Block item in the message menu */
573
+ emailDropdownMenuLock: boolean;
574
+ /** showing the Delete item in the message menu */
575
+ emailDropdownMenuRemove: boolean;
576
+ /** showing the Export button */
577
+ emailExportEnabled: boolean;
578
+ /** showing a secondary button */
579
+ nextButtonEnabled: boolean;
580
+ /** text of the secondary button */
581
+ nextButtonText: string;
582
+ /** showing the main button */
583
+ saveButtonEnabled: boolean;
584
+ /** text of the main button */
585
+ saveButtonText: string;
586
+ commandButtonsEnabled?: boolean;
587
+ /** displaying the email ID */
588
+ emailIdShow: boolean;
589
+ /** side panel view */
590
+ sidePanelFloating: boolean;
591
+ /** mode switching bar */
592
+ desktopMobileSwitchRule: boolean;
593
+ /** mode switching panel */
594
+ desktopMobileSwitchPanel: boolean;
595
+ /** showing the block save button */
596
+ saveBlockEnabled: boolean;
597
+ /** showing the image change button */
598
+ editImageControlEnabled: boolean;
599
+ /** ability to collapse the sidebar */
600
+ toggleSidePanel: boolean;
601
+
602
+ /** Sidebar location */
603
+ menuDirection: string;
604
+
605
+ /** default setting of the opening tab (""/"common"/"empty") */
606
+ defaultBuildPanel: string;
607
+
608
+ /** Sidebar */
609
+ commentsEnabled: boolean;
610
+ optimizeEnabled: boolean;
611
+ settingsEnabled: boolean;
612
+ UTMEnabled: boolean;
613
+ subjectEnabled: boolean;
614
+ preheaderEnabled: boolean;
615
+ descriptionEnabled: boolean;
616
+ tagsEnabled: boolean;
617
+ /** showing the mobile properties switch */
618
+ switchDesktopMobilePropsEnabled: boolean;
619
+ /** showing transition buttons to other elements */
620
+ stepToOtherElementEnabled: boolean;
621
+ /** showing the delete element button */
622
+ deleteButtonEnabled: boolean;
623
+ /** showing the Title field in the form of an image */
624
+ formFieldImageTitleEnabled: boolean;
625
+ /** showing border change fields */
626
+ formFieldBorderEnabled: boolean;
627
+ /** showing the rounding change fields */
628
+ formFieldBorderRadiusEnabled: boolean;
629
+ /** showing shadow change fields */
630
+ formFieldBoxShadowEnabled: boolean;
631
+ /** showing buttons to change the visibility of an element */
632
+ formFieldVisibilityEnabled: boolean;
633
+ /** showing the export to picture switch */
634
+ formFieldExportAsPictureEnabled: boolean;
635
+
636
+ /** showing the button to insert an image into the button text */
637
+ formButtonFieldInsertImageEnabled: boolean;
638
+ /** showing vertical alignment buttons */
639
+ formButtonFieldVerticalAlignEnabled: boolean;
640
+ /** showing text alignment buttons */
641
+ formButtonFieldTextAlignEnabled: boolean;
642
+ /** showing background image fields */
643
+ formButtonFieldBackgroundImageEnabled: boolean;
644
+ /** showing internal margins */
645
+ formButtonFieldPaddingsEnabled: boolean;
646
+ /** showing replacer button */
647
+ formButtonFieldReplacerEnabled: boolean;
648
+
649
+ /** showing vertical alignment buttons */
650
+ formCellFieldVerticalAlignEnabled: boolean;
651
+ /** showing background image fields */
652
+ formCellFieldBackgroundImageEnabled: boolean;
653
+ /** showing internal margins */
654
+ formCellFieldPaddingsEnabled: boolean;
655
+ /** showing sizes */
656
+ formCellFieldSizeEnabled: boolean;
657
+ /** showing the button to insert an image into the button text */
658
+ formLinkFieldInsertImageEnabled: boolean;
659
+ /** showing background image fields */
660
+ formTableFieldBackgroundImageEnabled: boolean;
661
+ /** showing background image fields */
662
+ formDivFieldBackgroundImageEnabled: boolean;
663
+ /** showing background image fields */
664
+ formEmailFieldBackgroundImageEnabled: boolean;
665
+ /** showing vertical alignment buttons */
666
+ formImageFieldVerticalAlignEnabled: boolean;
667
+ /** showing replacer button */
668
+ formImageFieldReplacerEnabled: boolean;
669
+ /** showing height field */
670
+ formImageFieldHeightEnabled: boolean;
671
+ /** showing typograf button */
672
+ formTextFieldTypografEnabled: boolean;
673
+ /** showing replacer button */
674
+ formTextFieldReplacerEnabled: boolean;
675
+
676
+ revisionService: boolean;
677
+
678
+ /** Elements */
679
+ elementImageEnabled: boolean;
680
+ elementTextEnabled: boolean;
681
+ elementHeaderEnabled: boolean;
682
+ elementButtonEnabled: boolean;
683
+ elementListULEnabled: boolean;
684
+ elementListOLEnabled: boolean;
685
+ elementDividerEnabled: boolean;
686
+ elementSpacerEnabled: boolean;
687
+ elementSocialEnabled: boolean;
688
+ elementTableEnabled: boolean;
689
+ elementCountdownEnabled: boolean;
690
+ elementVideoEnabled: boolean;
691
+ elementAIimageEnabled: boolean;
692
+ elementAItextEnabled: boolean;
693
+ elementCarouselEnabled: boolean;
694
+ elementFormEnabled: boolean;
695
+ elementAccordionEnabled: boolean;
696
+
697
+ /** type of image editor display */
698
+ imageCenterFileManagerView: boolean;
699
+
700
+ imageCenterStockEnabled: boolean;
701
+ imageCenterGifEnabled: boolean;
702
+ imageCenterEditorEnabled: boolean;
703
+ compressMaxSize: number;
704
+ compressMaxWidthOrHeight: number;
705
+
706
+ editor: EditorOptions;
707
+
708
+ locale: Locale;
709
+
710
+ codeModeDirection: CodeModeDirection;
711
+
712
+ preventSendDataToEM?: boolean;
713
+
714
+ mergeTags?: MergeTagsInfo;
715
+
716
+ /** showing the merge tags button */
717
+ mergeTagsShow?: boolean;
718
+
719
+ testEmails?: string[];
720
+
721
+ /** showing the config switch */
722
+ configSwither?: boolean;
723
+ /** Auto-save timeout */
724
+ autosaveTimeout?: number;
725
+ /** Configs that are passed to plugins */
726
+ advancedConfigs?: AdvancedConfigs;
727
+ onlyCodeModeInMobile?: boolean;
728
+
729
+ pushToGTM?: boolean;
730
+ /** header show */
731
+ headerShow?: boolean;
732
+ /** webversion show */
733
+ webversionEnabled?: boolean;
734
+ /** common styles show */
735
+ commonStylesEnabled?: boolean;
736
+ /** adaptive control show */
737
+ emailResponsiveControlEnabled?: boolean;
738
+ /** show export to text */
739
+ exportTextEnabled?: boolean;
740
+ /** show export to HTML */
741
+ exportHtmlEnabled?: boolean;
742
+ /** show export to ZIP */
743
+ exportZipEnabled?: boolean;
744
+ /** show export to buffer */
745
+ exportClipboardEnabled?: boolean;
746
+ /** show export to webhook */
747
+ exportWebHookEnabled?: boolean;
748
+ /** show export to Outlook */
749
+ exportOutlookEnabled?: boolean;
750
+ /** show export to PDF */
751
+ exportPdfEnabled?: boolean;
752
+ /** show export to PNG */
753
+ exportPngEnabled?: boolean;
754
+ /** AI assistant show */
755
+ aiAssistentEnabled?: boolean;
756
+ /** link check display */
757
+ optimizeLinksEnabled?: boolean;
758
+ /** picture check display */
759
+ optimizeImagesEnabled?: boolean;
760
+ /** SpamAssassin check display */
761
+ optimizeSpamAssassinEnabled?: boolean;
762
+ /** code check display */
763
+ optimizeCheckCodeEnabled?: boolean;
764
+ /** Displaying a field Template */
765
+ isTemplateEnabled?: boolean;
766
+ /** block menu display */
767
+ blocksSectionsShow?: boolean;
768
+ /** empty blocks display */
769
+ blocksEmptyEnabled?: boolean;
770
+ /** display of saved blocks */
771
+ blocksSavedEnabled?: boolean;
772
+ /** common blocks display */
773
+ blocksCommonEnabled?: boolean;
774
+ /** template blocks display */
775
+ blocksTemplateEnabled?: boolean;
776
+ /** block search display */
777
+ blocksSearchEnabled?: boolean;
778
+ /** showing the panel for adding a block in the visual editor */
779
+ blocksAddPanelEnabled?: boolean;
780
+ /** turns off template editing */
781
+ lockEditor?: boolean;
782
+ /** turns off preheader and title editing */
783
+ lockPreheaderAndTitle?: boolean;
784
+ /** turns off preheader and title editing */
785
+ disableSideMenu?: boolean;
786
+ /** Showing a drop-down card with a path to the picture */
787
+ imagePathDropdownEnabled?: boolean;
788
+
789
+ /** Showing change visibility buttons in amp emails */
790
+ formFieldAmpVisibilityEnabled?: boolean;
791
+ /** Disable double click on next button */
792
+ disableDoubleClickNextButton?: boolean;
793
+ /** manually change state of next button */
794
+ activeNextButton?: boolean;
795
+ }
796
+
797
+ export interface User {
798
+ id?: string | number;
799
+ /** The login name for the user. */
800
+ username?: string;
801
+ /** User's display name */
802
+ user?: string;
803
+ /** The user's email address. @format email */
804
+ email?: string;
805
+ /** URL of the user's avatar. */
806
+ avatar_urls?: {
807
+ /** URL avatars with an image size of 24 pixels. @format uri */
808
+ '24'?: string;
809
+ '48'?: string;
810
+ '96'?: string;
811
+ };
812
+ }
813
+
814
+ namespace AppConfigMixin {
815
+ interface Options {
816
+ config?: Partial<Config>;
817
+ advancedConfigs?: AdvancedConfigs;
818
+ project?: string | number;
819
+ user?: User;
820
+ handleReadLocale?: LocaleListener;
821
+ handleLimitUsage?: LimitListener;
822
+ }
823
+
824
+ interface Instance {
825
+ setConfig(config: Partial<Config>): Promise<void>;
826
+ getConfig(): Partial<Config>;
827
+ updateConfig(config: Partial<Config>): Promise<void>;
828
+ handleReadLocale: AppEvent<LocaleListener>;
829
+ handleLimitUsage?: AppEvent<LimitListener>;
830
+ }
831
+ }
832
+ interface Options extends AppConfigMixin.Options {}
833
+
834
+ interface Instance extends AppConfigMixin.Instance {}
835
+ }
836
+ declare namespace ExportedApi {
837
+ namespace AppInitMixin {
838
+ interface Options {
839
+ /** base url of the app server */
840
+ baseUrl?: string;
841
+ }
842
+
843
+ interface Instance {}
844
+ }
845
+ interface Options extends AppInitMixin.Options {}
846
+
847
+ interface Instance extends AppInitMixin.Instance {}
848
+ }
849
+
850
+ declare namespace ExportedApi {
851
+ export type JWTAuthOptions = {
852
+ email: string;
853
+ password: string;
854
+ remember?: boolean;
855
+ };
856
+
857
+ type JWTOptions = {
858
+ /** JWT authorization credentials */
859
+ jwtAuth?: JWTAuthOptions;
860
+ };
861
+ namespace JWTMixin {
862
+ interface Options extends JWTOptions {}
863
+
864
+ interface Instance {}
865
+ }
866
+ interface Options extends JWTMixin.Options {}
867
+
868
+ interface Instance extends JWTMixin.Instance {}
869
+ }
870
+ declare namespace ExportedApi {
871
+ type OAuthCallback = (prevToken?: string) => MayBePromise<string>;
872
+
873
+ type OAuthOptions = {
874
+ /**
875
+ * Get token callback
876
+ */
877
+ getAuthToken?: OAuthCallback;
878
+ };
879
+ namespace OAuthMixin {
880
+ interface Options extends OAuthOptions {}
881
+
882
+ interface Instance {}
883
+ }
884
+ interface Options extends OAuthMixin.Options {}
885
+
886
+ interface Instance extends OAuthMixin.Instance {}
887
+ }
888
+
889
+ declare namespace ExportedApi {
890
+ interface CoreOptions {
891
+ element?: string | Element | DocumentFragment;
892
+ handleChunkLoaded?: () => void;
893
+ }
894
+ namespace CoreMixin {
895
+ interface Options extends CoreOptions {}
896
+
897
+ interface Instance {
898
+ getElement(): Element | DocumentFragment | undefined;
899
+ }
900
+ }
901
+ interface Options extends CoreMixin.Options {}
902
+
903
+ interface Instance extends CoreMixin.Instance {}
904
+ }
905
+ declare namespace ExportedApi {
906
+ namespace DataMixin {
907
+ type BlockShowOptions = {
908
+ /** block content */
909
+ block: Block | string;
910
+ /** autosaves */
911
+ revisions?: BlockRevision[];
912
+ /** comments */
913
+ comments?: Comment[];
914
+ /** blocks */
915
+ blocks?: Block[];
916
+ /** template identifier for email */
917
+ templateId?: string | number;
918
+ };
919
+
920
+ type EmailShowOptions = {
921
+ /** email content */
922
+ email: Email | string;
923
+ /** autosaves */
924
+ autosaves?: EmailRevision[];
925
+ /** comments */
926
+ comments?: Comment[];
927
+ /** blocks */
928
+ blocks?: Block[];
929
+ /** template identifier for block */
930
+ templateId?: number;
931
+ };
932
+
933
+ type Content = string | Email | EmailShowOptions;
934
+
935
+ type ReadEmailHandler = (id: string) => MayBePromise<Email>;
936
+ type ReadEmailAutosavesHandler = (emailId: string) => MayBePromise<EmailRevision[]>;
937
+ type ReadBlocksHandler = (project: string) => MayBePromise<Block[]>;
938
+ type ReadTemplateBlocksHandler = ({ emailId: string, project: string }) => MayBePromise<Block[]>;
939
+ type ReadCommentsHandler = (emailId: string) => MayBePromise<Comment[]>;
940
+
941
+ type EmailHandler = AppListener<Email>;
942
+ type HtmlHandler = AppListener<string>;
943
+
944
+ type TestEmailSendEventPayload = {
945
+ project?: string;
946
+ email_id?: string;
947
+ subject?: string;
948
+ email?: string;
949
+ code?: string;
950
+ from_name?: string;
951
+ };
952
+
953
+ type TestEmailSendHandler = AppListener<TestEmailSendEventPayload, false | void>;
954
+
955
+ type TestEmailModalSendHandler = AppListener<Email, false | void>;
956
+
957
+ type LivePreviewHandler = AppListener<{
958
+ project?: string;
959
+ id: string;
960
+ subject?: string;
961
+ html: string;
962
+ }>;
963
+
964
+ type ShareHandler = AppListener<{
965
+ project?: string;
966
+ id: string;
967
+ }>;
968
+
969
+ type PreviewHandler = AppListener<{
970
+ project?: string;
971
+ id: string;
972
+ }>;
973
+
974
+ type ValidateEvent = AppListener<CodeError[]>;
975
+
976
+ interface Events {
977
+ /** read email handler */
978
+ handleReadEmail: AppEvent<ReadEmailHandler>;
979
+ /** fires when email saved */
980
+ handleSaveEmail: SaveEvent<Email>;
981
+ /** fires when email delete */
982
+ handleRemoveEmail: RemoveEvent<Email>;
983
+
984
+ /** read autosaves handler */
985
+ handleReadEmailRevisions: AppEvent<ReadEmailAutosavesHandler>;
986
+ /** fires when email autosave */
987
+ handleEmailAutosave: CreateEvent<EmailRevision>;
988
+ /** fires when email autosave delete */
989
+ handleRemoveEmailAutoSave: RemoveEvent<EmailRevision>;
990
+ /** read common blocks handler */
991
+ handleReadCommonBlocks: AppEvent<ReadBlocksHandler>;
992
+ /** read template blocks handler */
993
+ handleReadTemplateBlocks: AppEvent<ReadTemplateBlocksHandler>;
994
+ /** read blocks handler */
995
+ handleReadBlocks: AppEvent<ReadBlocksHandler>;
996
+ /** fires when block save */
997
+ handleSaveBlock: SaveEvent<Block>;
998
+ /** fires when block delete */
999
+ handleRemoveBlock: RemoveEvent<Block>;
1000
+
1001
+ /** read comments handler */
1002
+ handleReadComments: AppEvent<ReadCommentsHandler>;
1003
+ /** fires when comment save */
1004
+ handleSaveComment: SaveEvent<Comment>;
1005
+ /** fires when comment delete */
1006
+ handleRemoveComment: RemoveEvent<Comment>;
1007
+
1008
+ /** fires when user clicked on 'save' button */
1009
+ handleSaveButtonClick: AppEvent<EmailHandler>;
1010
+ /** fires when user clicked on 'next' button */
1011
+ handleNextButtonClick: AppEvent<EmailHandler>;
1012
+ /** fires when user clicked on 'previous' button */
1013
+ handlePreviousButtonClick: AppEvent<EmailHandler>;
1014
+ /** fires when email iframe inited */
1015
+ handleEmailInit: AppEvent<EmailHandler>;
1016
+ /** fires when email changed */
1017
+ handleEmailChanged: AppEvent<EmailHandler>;
1018
+ /** fires when email subject inited */
1019
+ handleSubjectChanged: (
1020
+ listener: (subject: string) => MayBePromise<void>,
1021
+ priority?: number,
1022
+ thisArg?: any,
1023
+ ) => () => void;
1024
+ /** fires when email subject inited */
1025
+ handlePreheaderChanged: (
1026
+ listener: (preheader: string) => MayBePromise<void>,
1027
+ priority?: number,
1028
+ thisArg?: any,
1029
+ ) => () => void;
1030
+ /** fires when email Html changed */
1031
+ handleHtmlChanged: AppEvent<HtmlHandler>;
1032
+ /** fires when test email send*/
1033
+ handleTestEmailSend: AppEvent<TestEmailSendHandler>;
1034
+ /** fires when open test email modal */
1035
+ handleTestEmailModal: AppEvent<TestEmailModalSendHandler>;
1036
+ /** fires when email clone */
1037
+ handleCloneEmail: AppEvent<EmailHandler>;
1038
+ /** fires when email share */
1039
+ handleShareEmail: AppEvent<ShareHandler>;
1040
+ /** fires when open live preview */
1041
+ handleLivePreviewEmail: AppEvent<LivePreviewHandler>;
1042
+ /** fires when open preview */
1043
+ handlePreviewEmail: AppEvent<PreviewHandler>;
1044
+ /** fires when email validate */
1045
+ handleValidate: AppEvent<ValidateEvent>;
1046
+ }
1047
+
1048
+ type Listeners = { [K in keyof Events]?: Events[K] extends AppEvent<infer Listener> ? Listener : never };
1049
+ interface Options extends Listeners {
1050
+ /** entity content */
1051
+ content: Content;
1052
+ }
1053
+
1054
+ interface Instance extends Events {
1055
+ /**
1056
+ * show block or email
1057
+ * @param content entity content
1058
+ */
1059
+ show(content: Content): Promise<void>;
1060
+ /** save current email */
1061
+ save(): Promise<Email>;
1062
+ /**
1063
+ * get email from inner storage
1064
+ */
1065
+ getEmail(): Promise<CompiledEmail>;
1066
+ /**
1067
+ * get compiled email
1068
+ */
1069
+ compileEmail(email?: Email, all?: boolean | { text?: boolean; amp?: boolean }): Promise<CompiledEmail>;
1070
+ /**
1071
+ * get blocks from inner storage
1072
+ */
1073
+ getBlocks(): Promise<Block[]>;
1074
+ /**
1075
+ * get email satosaves
1076
+ * @param emailId email identifier
1077
+ */
1078
+ getEmailRevisions(): Promise<EmailRevision[]>;
1079
+ /**
1080
+ * get email comments
1081
+ */
1082
+ getComments(): Promise<Comment[]>;
1083
+ /**
1084
+ * get current code errors
1085
+ */
1086
+ getCodeErrors(): CodeError[] | undefined;
1087
+ }
1088
+ }
1089
+ interface Options extends DataMixin.Options {
1090
+ standaloneKey?: string;
1091
+ }
1092
+
1093
+ interface Instance extends DataMixin.Instance {}
1094
+ }
1095
+ declare namespace ExportedApi {
1096
+ namespace DestroyableMixin {
1097
+ type DestroyListener = AppListener<ExportedApi.Instance>;
1098
+ interface Options {
1099
+ handleDestroy?: DestroyListener;
1100
+ }
1101
+
1102
+ interface Instance {
1103
+ /** fires when app destroyed */
1104
+ handleDestroy: AppEvent<DestroyListener>;
1105
+ destroy(): void;
1106
+ }
1107
+ }
1108
+ interface Options extends DestroyableMixin.Options {}
1109
+
1110
+ interface Instance extends DestroyableMixin.Instance {}
1111
+ }
1112
+ declare namespace ExportedApi {
1113
+ namespace SpinMixin {
1114
+ interface Options {
1115
+ element?: string | Element | DocumentFragment;
1116
+ initialSpinner?: false;
1117
+ }
1118
+
1119
+ interface Instance {}
1120
+ }
1121
+ interface Options extends SpinMixin.Options {}
1122
+
1123
+ interface Instance extends SpinMixin.Instance {}
1124
+ }
1125
+ declare namespace ExportedApi {
1126
+ namespace ImageHandlerMixin {
1127
+ type LoadEventPayload = { file: File; project: string };
1128
+ type FileProxyEventPayload = { url: string; project: string };
1129
+ type LoadImageListener = AppListener<LoadEventPayload, string | void>;
1130
+ type FileProxyListener = AppListener<FileProxyEventPayload, Blob | void>;
1131
+ interface Options {
1132
+ handleLoadImage?: LoadImageListener;
1133
+ handleFileProxy?: FileProxyListener;
1134
+ }
1135
+
1136
+ interface Instance {
1137
+ /** fires when image loading */
1138
+ handleLoadImage: AppEvent<LoadImageListener>;
1139
+ handleFileProxy: AppEvent<FileProxyListener>;
1140
+ }
1141
+ }
1142
+ interface Options extends ImageHandlerMixin.Options {}
1143
+
1144
+ interface Instance extends ImageHandlerMixin.Instance {}
1145
+ }
1146
+ declare namespace ExportedApi {
1147
+ namespace LoadHandlerMixin {
1148
+ type LoadListener = AppListener<ExportedApi.Instance>;
1149
+ interface Options {
1150
+ handleLoad?: LoadListener;
1151
+ }
1152
+
1153
+ interface Instance {
1154
+ /** fires when app loaded */
1155
+ handleLoad: AppEvent<LoadListener>;
1156
+ reset(options: ExportedApi.Options): Promise<ExportedApi.Instance>;
1157
+ }
1158
+ }
1159
+ interface Options extends LoadHandlerMixin.Options {}
1160
+
1161
+ interface Instance extends LoadHandlerMixin.Instance {}
1162
+ }
1163
+ declare namespace ExportedApi {
1164
+ type ConfigNotify = Notify & Partial<NotifyEvent> & { message: string | HTMLElement };
1165
+ namespace NotificationMixin {
1166
+ type NotifyListener = AppListener<NotifyEvent, ConfigNotify | string | false | void>;
1167
+ type ErrorListener = AppListener<Notify.ErrorEvent, ConfigNotify | string | false | void>;
1168
+ type SuccessListener = AppListener<Notify.SuccessEvent, ConfigNotify | string | false | void>;
1169
+ interface Options {
1170
+ handleNotify?: NotifyListener;
1171
+ handleError?: ErrorListener;
1172
+ handleSuccess?: SuccessListener;
1173
+ }
1174
+
1175
+ interface Instance {
1176
+ handleNotify: AppEvent<NotifyListener>;
1177
+ handleError: AppEvent<ErrorListener>;
1178
+ handleSuccess: AppEvent<SuccessListener>;
1179
+ notify(config: ConfigNotify | string): void;
1180
+ }
1181
+ }
1182
+ interface Options extends NotificationMixin.Options {}
1183
+
1184
+ interface Instance extends NotificationMixin.Instance {}
1185
+ }
1186
+
1187
+ interface EditStackData {
1188
+ serialize(): ArrayBuffer;
1189
+ }
1190
+
1191
+ interface EditStackSnapshot {
1192
+ resource: string;
1193
+ elements: unknown[];
1194
+ }
1195
+
1196
+ interface IUndoRedoService {
1197
+ /**
1198
+ * Undoes the last performed action, reverting the state to the previous step in history.
1199
+ * If the history is empty, this method does nothing.
1200
+ */
1201
+ undo: () => void;
1202
+
1203
+ /**
1204
+ * Redoes an undone action, moving the state forward in history.
1205
+ * If there are no undone actions, this method does nothing.
1206
+ */
1207
+ redo: () => void;
1208
+
1209
+ /**
1210
+ * Clears the entire history of changes, including both undone and redone operations.
1211
+ * After calling this method, both the `undo` and `redo` histories will be empty.
1212
+ */
1213
+ clear: () => void;
1214
+
1215
+ /**
1216
+ * Returns an array of all previously performed changes that can be undone.
1217
+ * This represents the stack of actions available for `undo()`.
1218
+ * @returns An array of `EditStackData` objects representing past changes.
1219
+ */
1220
+ getPast: () => EditStackData[];
1221
+
1222
+ /**
1223
+ * Returns an array of changes that have been undone and can be redone.
1224
+ * This represents the stack of actions available for `redo()`.
1225
+ * @returns An array of `EditStackData` objects representing future changes.
1226
+ */
1227
+ getFuture: () => EditStackData[];
1228
+
1229
+ /**
1230
+ * Checks whether there is at least one action in history that can be undone.
1231
+ * @returns `true` if `undo()` can be performed, otherwise `false`.
1232
+ */
1233
+ canUndo: () => boolean;
1234
+
1235
+ /**
1236
+ * Checks whether there is at least one undone action that can be redone.
1237
+ * @returns `true` if `redo()` can be performed, otherwise `false`.
1238
+ */
1239
+ canRedo: () => boolean;
1240
+
1241
+ /**
1242
+ * Creates a snapshot of the current state, which can be saved and restored later.
1243
+ * Useful for serializing the change history.
1244
+ * @returns An `EditStackSnapshot` object containing the state of the change history.
1245
+ */
1246
+ createSnapshot: () => EditStackSnapshot;
1247
+
1248
+ /**
1249
+ * Restores the change history state from the provided snapshot.
1250
+ * Allows loading a previously saved history.
1251
+ * @param snapshot An `EditStackSnapshot` object containing the saved history state.
1252
+ */
1253
+ restoreSnapshot: (snapshot: EditStackSnapshot) => void;
1254
+ }
1255
+
1256
+ /**
1257
+ * Folder information.
1258
+ */
1259
+ export interface FolderInfo {
1260
+ /** Unique folder identifier */
1261
+ id: string;
1262
+ /** Folder name */
1263
+ name: string;
1264
+ /** Parent folder identifier (null or undefined if it's a root folder) */
1265
+ parentId?: string | null;
1266
+ }
1267
+
1268
+ /**
1269
+ * File information.
1270
+ */
1271
+ export interface FileInfo {
1272
+ /** Unique file identifier */
1273
+ id: string;
1274
+ /** File name */
1275
+ name: string;
1276
+ /** File size as a string (e.g., "15MB") */
1277
+ size: string;
1278
+ /** File creation or upload date */
1279
+ date: string;
1280
+ /** Identifier of the folder the file belongs to */
1281
+ folderId: string;
1282
+ /** File MIME type */
1283
+ type?: string;
1284
+ /** File download URL (used if `getFile` method is not implemented) */
1285
+ url?: string;
1286
+ /** File thumbnail */
1287
+ thumbnail?: string;
1288
+ /** Alternative thumbnail URL */
1289
+ thumbnailUrl?: string;
1290
+ /** Image dimensions (width x height) */
1291
+ dimensions?: string;
1292
+ /** Aspect ratio */
1293
+ aspectRatio?: string;
1294
+ /** File extension */
1295
+ extension?: string;
1296
+ /** Whether the file is selected in the UI */
1297
+ selected?: boolean;
1298
+ /** Whether the item is a folder */
1299
+ isFolder?: boolean;
1300
+ /** Date when the file was last edited */
1301
+ lastEdited?: string;
1302
+ }
1303
+
1304
+ /**
1305
+ * API response with pagination details.
1306
+ */
1307
+ export interface ApiPaginationResponse {
1308
+ /** Current page number */
1309
+ page: number;
1310
+ /** Number of items per page */
1311
+ limit: number;
1312
+ /** Total number of items */
1313
+ total: number;
1314
+ /** Total number of pages */
1315
+ totalPages: number;
1316
+ /** Whether there is a next page */
1317
+ hasNext: boolean;
1318
+ /** Whether there is a previous page */
1319
+ hasPrev: boolean;
1320
+ }
1321
+
1322
+ /**
1323
+ * Sorting state.
1324
+ */
1325
+ export interface SortState {
1326
+ /** Field to sort by */
1327
+ sortBy: 'name' | 'size' | 'date' | 'type';
1328
+ /** Sort order */
1329
+ sortOrder: 'asc' | 'desc';
1330
+ }
1331
+
1332
+ /**
1333
+ * Interface for storage providers.
1334
+ * Defines the contract for different storage backends (e.g., cloud APIs).
1335
+ */
1336
+ export interface StorageProvider {
1337
+ /**
1338
+ * Retrieve the file content as a binary blob.
1339
+ *
1340
+ * ⚠️ If this method is not implemented, the file will be downloaded
1341
+ * using the `url` property from the `FileInfo` object.
1342
+ *
1343
+ * @param fileId File identifier
1344
+ * @returns File contents as a Blob
1345
+ */
1346
+ getFile?: (fileId: string) => Promise<Blob>;
1347
+
1348
+ /**
1349
+ * Retrieve a list of folders.
1350
+ *
1351
+ * @returns List of folder objects
1352
+ */
1353
+ getFolders: () => Promise<FolderInfo[]>;
1354
+
1355
+ /**
1356
+ * Retrieve a list of files.
1357
+ * Supports filtering, sorting, and pagination.
1358
+ *
1359
+ * @param options.folderId Folder identifier (default: root folder)
1360
+ * @param options.search Search query
1361
+ * @param options.sortBy Field to sort by
1362
+ * @param options.sortOrder Sort direction
1363
+ * @param options.page Page number
1364
+ * @param options.limit Number of items per page
1365
+ * @returns List of files and optional pagination details
1366
+ */
1367
+ getFiles: (options: {
1368
+ folderId?: string;
1369
+ search?: string;
1370
+ sortBy?: SortState['sortBy'];
1371
+ sortOrder?: SortState['sortOrder'];
1372
+ page?: number;
1373
+ limit?: number;
1374
+ }) => Promise<{
1375
+ files: FileInfo[];
1376
+ pagination?: Partial<ApiPaginationResponse>;
1377
+ }>;
1378
+
1379
+ /**
1380
+ * Create a new folder.
1381
+ *
1382
+ * @param data.name Folder name
1383
+ * @param data.parentId Parent folder identifier (or null/undefined for root)
1384
+ * @returns The created folder object
1385
+ */
1386
+ createFolder: (data: { name: string; parentId?: string | null }) => Promise<FolderInfo>;
1387
+
1388
+ /**
1389
+ * Rename a folder.
1390
+ *
1391
+ * @param folderId Folder identifier
1392
+ * @param newName New folder name
1393
+ * @returns Updated folder object
1394
+ */
1395
+ renameFolder: (folderId: string, newName: string) => Promise<FolderInfo>;
1396
+
1397
+ /**
1398
+ * Delete a folder.
1399
+ *
1400
+ * @param folderId Folder identifier
1401
+ * @returns true if deletion was successful
1402
+ */
1403
+ deleteFolder: (folderId: string) => Promise<boolean>;
1404
+
1405
+ /**
1406
+ * Upload a file.
1407
+ *
1408
+ * @param file.name File name
1409
+ * @param file.size File size
1410
+ * @param file.type MIME type
1411
+ * @param file.folderId Target folder identifier (or null/undefined for root)
1412
+ * @param file.data File data (Blob or base64 string)
1413
+ * @param file.thumbnail Thumbnail image
1414
+ * @param file.dimensions Image dimensions
1415
+ * @param file.aspectRatio Aspect ratio
1416
+ * @param file.extension File extension
1417
+ * @returns The uploaded file object
1418
+ */
1419
+ uploadFile: (file: {
1420
+ name: string;
1421
+ size: string;
1422
+ type: string;
1423
+ folderId?: string | null;
1424
+ data: Blob | string;
1425
+ thumbnail?: string;
1426
+ dimensions?: string;
1427
+ aspectRatio?: string;
1428
+ extension?: string;
1429
+ }) => Promise<FileInfo>;
1430
+
1431
+ /**
1432
+ * Upload a file by URL.
1433
+ *
1434
+ * ⚠️ Implementation should check if the file already belongs
1435
+ * to the current server. If it does, return the existing file object
1436
+ * instead of uploading it again.
1437
+ *
1438
+ * @param data.url File URL
1439
+ * @param data.folderId Target folder identifier (or null/undefined for root)
1440
+ * @param data.noFolder If true, the file should be uploaded to a temporary
1441
+ * folder (for example, when editing a file)
1442
+ * @returns The uploaded or existing file object
1443
+ */
1444
+ uploadFileByUrl: (data: { url: string; folderId?: string | null; noFolder?: boolean }) => Promise<FileInfo>;
1445
+
1446
+ /**
1447
+ * Delete a file.
1448
+ *
1449
+ * @param fileId File identifier
1450
+ * @returns true if deletion was successful
1451
+ */
1452
+ deleteFile: (fileId: string) => Promise<boolean>;
1453
+
1454
+ /**
1455
+ * Rename a file.
1456
+ *
1457
+ * @param fileId File identifier
1458
+ * @param newName New file name
1459
+ * @returns Updated file object
1460
+ */
1461
+ renameFile: (fileId: string, newName: string) => Promise<FileInfo>;
1462
+
1463
+ /**
1464
+ * Move a file or folder to another location.
1465
+ *
1466
+ * @param options.itemId Identifier of the item to move
1467
+ * @param options.targetFolderId Target folder identifier
1468
+ * @param options.isFolder true if the item is a folder
1469
+ * @returns true if the move operation was successful
1470
+ */
1471
+ moveItem: (options: { itemId: string; targetFolderId: string; isFolder: boolean }) => Promise<boolean>;
1472
+
1473
+ /**
1474
+ * Copy a file or folder.
1475
+ *
1476
+ * @param options.itemId Identifier of the item to copy
1477
+ * @param options.targetFolderId Target folder identifier
1478
+ * @param options.isFolder true if the item is a folder
1479
+ * @returns Object with the new item identifier (and optionally a new URL)
1480
+ */
1481
+ copyItem: (options: {
1482
+ itemId: string;
1483
+ targetFolderId: string;
1484
+ isFolder: boolean;
1485
+ }) => Promise<{ id: string; url?: string }>;
1486
+
1487
+ /**
1488
+ * Update file metadata or content.
1489
+ *
1490
+ * @param fileId File identifier
1491
+ * @param updates Object with fields to update (name, type, data, thumbnail, etc.)
1492
+ * @returns Updated file object
1493
+ */
1494
+ updateFile: (
1495
+ fileId: string,
1496
+ updates: {
1497
+ name?: string;
1498
+ type?: string;
1499
+ data?: Blob | string;
1500
+ thumbnail?: string;
1501
+ dimensions?: string;
1502
+ aspectRatio?: string;
1503
+ extension?: string;
1504
+ },
1505
+ ) => Promise<FileInfo>;
1506
+ }
1507
+
1508
+ declare module ExportedApi {
1509
+ export interface Options {
1510
+ storageProvider?: StorageProvider;
1511
+ }
1512
+ }
1513
+
1514
+ declare namespace ExportedApi {
1515
+ namespace UndoRedoMixin {
1516
+ interface Instance {
1517
+ /**
1518
+ * An instance of `IUndoRedoService` that manages undo and redo operations.
1519
+ */
1520
+ undoRedoService: IUndoRedoService;
1521
+ }
1522
+ }
1523
+
1524
+ interface Instance extends UndoRedoMixin.Instance {}
1525
+ }
1526
+
1527
+ declare namespace ExportedApi {
1528
+ interface Instance {
1529
+ /** reset app config */
1530
+ reset(options: Options): Promise<Instance>;
1531
+ }
1532
+ }
1533
+
1534
+ export type Instance = ExportedApi.Instance;
1535
+
1536
+ export type Options = ExportedApi.Options;
1537
+
1538
+ /**
1539
+ * initialize app instance
1540
+ * @param {options} app options
1541
+ * @returns app instance
1542
+ */
1543
+ export function init(options: Options): Promise<Instance>;
1544
+ /**
1545
+ * parse AMP email
1546
+ * @param {code} email or code
1547
+ * @returns object, contains pure html and AMP code
1548
+ */
1549
+ export function parseAMP(code: string | { code: string }): Promise<ParsedAMP>;
1550
+ /**
1551
+ * app version
1552
+ */
1553
+ export const version: string;