@topol.io/editor 1.0.0-alpha.1 → 1.0.0-alpha.11

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.
Files changed (74) hide show
  1. package/README.md +153 -101
  2. package/dist/topol-plugin.es.js +146 -191
  3. package/dist/topol-plugin.umd.cjs +1 -0
  4. package/dist/types/src/core/script-loader.d.ts +15 -0
  5. package/dist/types/src/email-editor/constants.d.ts +3 -3
  6. package/dist/types/src/email-editor/index.d.ts +16 -91
  7. package/dist/types/src/landing-page-editor/constants.d.ts +1 -1
  8. package/dist/types/src/landing-page-editor/index.d.ts +27 -10
  9. package/dist/types/src/landing-page-editor/schemas/api/apiSchema.d.ts +5 -10
  10. package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +34 -18
  11. package/dist/types/src/landing-page-editor/schemas/language/languageSchema.d.ts +1 -1
  12. package/dist/types/src/landing-page-editor/schemas/mjmlStore/mjmlStoreSchema.d.ts +8 -6
  13. package/dist/types/src/landing-page-editor/schemas/notification/notificationSchema.d.ts +0 -1
  14. package/dist/types/src/landing-page-editor/schemas/openAI/openAISchema.d.ts +1 -2
  15. package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +153 -17
  16. package/dist/types/src/landing-page-editor/schemas/premadeSection/premadeSectionSchema.d.ts +30 -0
  17. package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +687 -5
  18. package/dist/types/src/landing-page-editor/schemas/template/blocks/carouselBlockSchema.d.ts +9 -2
  19. package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +11 -3
  20. package/dist/types/src/landing-page-editor/schemas/template/blocks/formBlockSchema.d.ts +1069 -0
  21. package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +35 -19
  22. package/dist/types/src/landing-page-editor/schemas/template/blocks/rawBlockSchema.d.ts +9 -1
  23. package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +11 -3
  24. package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +18 -10
  25. package/dist/types/src/landing-page-editor/schemas/template/blocks/textBlockSchema.d.ts +9 -1
  26. package/dist/types/src/landing-page-editor/schemas/template/blocks/videoBlockSchema.d.ts +9 -1
  27. package/dist/types/src/landing-page-editor/schemas/template/commonSchema.d.ts +28 -8
  28. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarCTASchema.d.ts +335 -0
  29. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarHamburgerSchema.d.ts +1109 -0
  30. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarLogoSchema.d.ts +252 -0
  31. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarMenuSchema.d.ts +1209 -0
  32. package/dist/types/src/landing-page-editor/schemas/template/settingsSchema.d.ts +4058 -546
  33. package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +5007 -2328
  34. package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +5501 -2412
  35. package/dist/types/src/landing-page-editor/schemas/template/structure/navbarSchema.d.ts +4394 -0
  36. package/dist/types/src/landing-page-editor/schemas/template/structure/rowSchema.d.ts +11094 -0
  37. package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +8602 -3337
  38. package/dist/types/src/landing-page-editor/schemas/template/styleSchema.d.ts +55 -44
  39. package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +34865 -48464
  40. package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4305 -794
  41. package/dist/types/src/landing-page-editor/schemas/theme/themeSchema.d.ts +6 -1
  42. package/dist/types/src/landing-page-editor/schemas/utils/cssValue.d.ts +21 -0
  43. package/dist/types/src/landing-page-editor/schemas/utils/transformBorder.d.ts +10 -5
  44. package/dist/types/src/main.d.ts +28 -101
  45. package/dist/types/types/API/API.d.ts +10 -9
  46. package/dist/types/types/APIBlocks/APIBlocks.d.ts +11 -0
  47. package/dist/types/types/Auth/IAuthorize.d.ts +18 -0
  48. package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +10 -0
  49. package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +28 -18
  50. package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +85 -104
  51. package/dist/types/types/Cloud/ICloudOptions.d.ts +32 -0
  52. package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
  53. package/dist/types/types/Countdown/ICountdownOptions.d.ts +48 -0
  54. package/dist/types/types/IEmailConfig.d.ts +225 -0
  55. package/dist/types/types/IEmailEditorInstance.d.ts +68 -0
  56. package/dist/types/types/IEmailOptions.d.ts +7 -0
  57. package/dist/types/types/Language/Language.d.ts +6 -1
  58. package/dist/types/types/MergeTag/IMergeTag.d.ts +18 -0
  59. package/dist/types/types/Notification/INotification.d.ts +2 -1
  60. package/dist/types/types/Sections/ISections.d.ts +41 -0
  61. package/dist/types/types/Shortcuts/EditorShortcut.d.ts +4 -0
  62. package/dist/types/types/Theme/ITheme.d.ts +12 -2
  63. package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +73 -9
  64. package/dist/types/types/landing-page/ILandingPageOptions.d.ts +110 -62
  65. package/package.json +10 -13
  66. package/dist/topol-plugin.umd.js +0 -1
  67. package/dist/types/src/landing-page-editor/schemas/helpdesk/helpdeskSchema.d.ts +0 -8
  68. package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +0 -59750
  69. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +0 -44831
  70. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +0 -59725
  71. package/dist/types/src/landing-page-editor/schemas/template/blocks/index.d.ts +0 -12
  72. package/dist/types/types/ITopolOptions.d.ts +0 -123
  73. package/dist/types/types/ITopolPlugin.d.ts +0 -37
  74. package/dist/types/types/SavedBlock/ISavedBlock.d.ts +0 -6
@@ -0,0 +1,225 @@
1
+ import type { IAuthorize } from "./Auth/IAuthorize";
2
+ import type IAPI from "./API/API";
3
+ import type IAPIBlockProperties from "./APIBlocks/APIBlocks";
4
+ import type { ISavedSection, IPremadeSectionsOptions } from "./Sections/ISections";
5
+ import type { ICloudOptions } from "./Cloud/ICloudOptions";
6
+ import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
7
+ import type { IContentBlockOptions } from "./ContentBlock/IContentBlockOptions";
8
+ import type { ICountdownOptions } from "./Countdown/ICountdownOptions";
9
+ import type ITheme from "./Theme/ITheme";
10
+ import type IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
11
+ import type IFont from "./Font/IFont";
12
+ import type ICustomBlockData from "./CustomBlocks/CustomBlocks";
13
+ import type { Language, IMultilingualLanguage } from "./Language/Language";
14
+ import type IMergeTag from "./MergeTag/IMergeTag";
15
+ import type SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
16
+ import type IUser from "./User/User";
17
+ import type IHelpdesk from "./Helpdesk/Helpdesk";
18
+ import type { EmailEditorShortcut } from "./Shortcuts/EditorShortcut";
19
+ type TopolTagAttribute = "font-family" | "font-size" | "font-weight" | "font-style" | "letter-spacing" | "text-transform" | "text-decoration" | "background-color" | "color" | "border-collapse";
20
+ type DefaultTemplateLangsSchema = {
21
+ code: string;
22
+ primary: boolean;
23
+ }[];
24
+ /**
25
+ * Configuration options for the Email Editor: the `config` of `EmailEditor.init({ config, ...callbacks })`.
26
+ */
27
+ export default interface IEmailConfig {
28
+ authorize: IAuthorize;
29
+ aiLabeledElements?: boolean;
30
+ api?: IAPI;
31
+ apiAuthorizationHeader?: IAuthHeaderConfig | string;
32
+ apiBlocks?: Record<string, IAPIBlockProperties>;
33
+ autosaveInterval?: number;
34
+ betaFeatures?: {
35
+ carousel?: boolean;
36
+ loop?: boolean;
37
+ rating?: boolean;
38
+ };
39
+ chatAI?: boolean;
40
+ chatAIOnSegment?: boolean;
41
+ /**
42
+ * Lets users exclude single links from click tracking: shows the "disable click tracking"
43
+ * switch (button, text links) and names the provider the opt-out is rendered for.
44
+ * Independent of `emailServiceProvider`, which only picks the merge tag syntax.
45
+ */
46
+ clickTrackingOptOut?: {
47
+ provider: "sparkpost";
48
+ };
49
+ cloud?: ICloudOptions;
50
+ colors?: Array<string>;
51
+ contentBlocks?: IContentBlockOptions;
52
+ /** Countdown block settings of the host (the block itself is gated by the add-on flag in the nonce). */
53
+ countdown?: ICountdownOptions;
54
+ currentUser?: IUser;
55
+ customBlocks?: ICustomBlockData[];
56
+ customFileManager?: boolean;
57
+ customFonts?: {
58
+ override?: boolean;
59
+ fonts: Array<IFont>;
60
+ };
61
+ customLanguagePreset?: {
62
+ langs: IMultilingualLanguage;
63
+ override?: boolean;
64
+ };
65
+ defaultTemplateSettings?: {
66
+ emailWidth?: number;
67
+ emailBackgroundColor?: string;
68
+ /** Background color of sections. */
69
+ sectionBackgroundColor?: string;
70
+ /** @deprecated Use `sectionBackgroundColor`. */
71
+ blockBackgroundColor?: string;
72
+ buttonsBackgroundColor?: string;
73
+ hyperlinkColor?: string;
74
+ h1?: {
75
+ [key in TopolTagAttribute]?: string;
76
+ };
77
+ h2?: {
78
+ [key in TopolTagAttribute]?: string;
79
+ };
80
+ h3?: {
81
+ [key in TopolTagAttribute]?: string;
82
+ };
83
+ p?: {
84
+ [key in TopolTagAttribute]?: string;
85
+ };
86
+ button?: Record<string, unknown>;
87
+ carousel?: Record<string, unknown>;
88
+ divider?: Record<string, unknown>;
89
+ gif?: Record<string, unknown>;
90
+ image?: Record<string, unknown>;
91
+ loop?: Record<string, unknown>;
92
+ social?: Record<string, unknown>;
93
+ text?: Record<string, unknown>;
94
+ column?: Record<string, unknown>;
95
+ section?: Record<string, unknown>;
96
+ /** Padding of sections. */
97
+ sectionPadding?: string;
98
+ lineHeight?: number;
99
+ stackColumns?: boolean;
100
+ /** @deprecated Use `sectionPadding`. */
101
+ "structure-margin"?: string;
102
+ /** @deprecated Use `lineHeight`. */
103
+ "line-height"?: number;
104
+ /** @deprecated Use `stackColumns`. */
105
+ "stack-columns"?: boolean;
106
+ langs?: DefaultTemplateLangsSchema;
107
+ };
108
+ disableAiAssistant?: boolean;
109
+ disableAlerts?: boolean;
110
+ disableExtendedComparators?: boolean;
111
+ /** `true` turns every editor keyboard shortcut off; an array only the listed ones. */
112
+ disableShortcuts?: boolean | EmailEditorShortcut[];
113
+ emailServiceProvider?: "mailchimp" | "sparkpost" | "jinja";
114
+ enableAutosaves?: boolean;
115
+ enableComments?: boolean;
116
+ enableDarkMode?: boolean;
117
+ enableFileManagerInGif?: boolean;
118
+ enableSubjectLine?: boolean;
119
+ enableImageToTextRatio?: boolean;
120
+ enableMergeTagPreview?: boolean;
121
+ enableSectionVariants?: boolean;
122
+ enableTemplateSizeInfo?: boolean;
123
+ fileManagerPreferences?: {
124
+ defaultTilesView?: boolean;
125
+ hidePexelsIntegration?: boolean;
126
+ maxUploadingFiles?: number;
127
+ };
128
+ fontSizes?: Array<number>;
129
+ googlePromotionalAnnotation?: boolean;
130
+ helpdesk?: IHelpdesk;
131
+ hideSettingsTab?: boolean;
132
+ /** @deprecated Use `hideSelectionPanel`; it wins when both are set. */
133
+ hideControlPanel?: boolean;
134
+ hideSelectionPanel?: boolean;
135
+ hideSelectionPanelExpand?: boolean;
136
+ htmlDesktopFirst?: boolean;
137
+ htmlMinified?: boolean;
138
+ imageCompressionOptions?: {
139
+ qualityJpeg?: number;
140
+ qualityPng?: number;
141
+ enableAutoResize?: boolean;
142
+ enableCompression?: boolean;
143
+ };
144
+ imageEditor?: boolean;
145
+ imageEditorOptions?: {
146
+ hideControls?: Array<string>;
147
+ };
148
+ imageMaxSize?: number;
149
+ lambdaStage?: "local" | "production" | "stage1" | "stage2" | "stage3";
150
+ language?: Language;
151
+ languageMergeTag?: string;
152
+ light?: boolean;
153
+ logicalOperatorsInsideVariant?: boolean;
154
+ mainMenuAlign?: "left" | "right";
155
+ mergeTags?: Array<IMergeTagGroup | IMergeTag>;
156
+ mobileFirstEnabled?: boolean;
157
+ multilingual?: boolean;
158
+ premadeSections?: IPremadeSectionsOptions;
159
+ premadeTemplates?: boolean;
160
+ premadeTemplatesOptions?: {
161
+ hideSearch?: boolean;
162
+ showDelete?: boolean;
163
+ };
164
+ productMergeTags?: {
165
+ label: string;
166
+ value: string;
167
+ }[];
168
+ /** @deprecated Use `productMergeTags`. */
169
+ productMergetagTags?: {
170
+ label: string;
171
+ value: string;
172
+ }[];
173
+ permissions?: {
174
+ canLockBlocks?: boolean;
175
+ canLockSections?: boolean;
176
+ canEditLockedSections?: boolean;
177
+ canEditLockedBlocks?: boolean;
178
+ canRemoveFiles?: boolean;
179
+ };
180
+ ecm?: {
181
+ articleFeeds?: string;
182
+ articles?: string;
183
+ dataFeeds?: string;
184
+ showArticleBlock?: boolean;
185
+ };
186
+ removeTopBar?: boolean;
187
+ /**
188
+ * How Save and Save & Close are laid out when both are visible: `"dropdown"` (default) tucks
189
+ * Save & Close under the Save button's menu, `"separate"` renders two standalone buttons.
190
+ * Ignored when either button is hidden via `hideTopbarControls`.
191
+ */
192
+ saveAndCloseButton?: "dropdown" | "separate";
193
+ renameTemplate?: boolean;
194
+ role?: "manager" | "editor" | "reader";
195
+ savedSections?: ISavedSection[] | boolean | null;
196
+ /** @deprecated Use `hideSelectionPanelExpand` (inverted); it wins when both are set. */
197
+ showControlPanelExpand?: boolean;
198
+ showUnsavedDialogBeforeExit?: boolean;
199
+ smartMergeTags?: {
200
+ enabled: boolean;
201
+ patterns?: Record<string, SmartMergeTagPattern>;
202
+ syntax?: {
203
+ start: string;
204
+ end: string;
205
+ };
206
+ };
207
+ startWithOpenElementsPanel?: boolean;
208
+ syncedSectionsEnabled?: boolean;
209
+ teamUsers?: IUser[];
210
+ templateId?: number | string;
211
+ testingEmails?: boolean | string[];
212
+ textEditor?: "tinymce" | "tiptap";
213
+ textEditorToolbarBottomPosition?: "left" | "center" | "right";
214
+ textOverride?: Record<string, string>;
215
+ theme?: ITheme;
216
+ tinyConfig?: unknown;
217
+ tiptapConfig?: {
218
+ light?: boolean;
219
+ showMergeTagText?: boolean;
220
+ };
221
+ title?: string;
222
+ hideTopbarControls?: string[];
223
+ windowBar?: Array<string>;
224
+ }
225
+ export {};
@@ -0,0 +1,68 @@
1
+ import type IEmailConfig from "./IEmailConfig";
2
+ import type INotification from "./Notification/INotification";
3
+ import type { ISavedSection } from "./Sections/ISections";
4
+ import type IMergeTag from "./MergeTag/IMergeTag";
5
+ import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
6
+ import type { ILanguageMutation } from "./Callbacks/ICallbackPayloads";
7
+ export interface IUpdateTemplateOptions {
8
+ skipSnapshot?: boolean;
9
+ }
10
+ /** Per-instance methods cross the iframe boundary asynchronously. Use onInit to observe successful authentication. */
11
+ export default interface IEmailEditorInstance {
12
+ render(container: string | HTMLElement): Promise<void>;
13
+ destroy(): Promise<void>;
14
+ /** Alias of destroy(), the name the script-tag instance has always had. */
15
+ close(): Promise<void>;
16
+ /** Resolves once the template is actually applied. */
17
+ load: (json: unknown) => Promise<void>;
18
+ /**
19
+ * Resolves once the save (render/persist + host onSave) has settled; the onSave fired
20
+ * meanwhile is this call's answer. Rejects with an Error whose `code` is
21
+ * `"SAVE_IN_PROGRESS"` while another save is still running (no onSave fires then).
22
+ */
23
+ save: (payload?: {
24
+ langCode?: string;
25
+ }) => Promise<void>;
26
+ togglePreview: () => Promise<void>;
27
+ togglePreviewSize: () => Promise<void>;
28
+ toggleDarkMode: () => Promise<void>;
29
+ chooseFile: (url: string) => Promise<void>;
30
+ undo: () => Promise<void>;
31
+ redo: () => Promise<void>;
32
+ setSavedSections: (savedSections: ISavedSection[]) => Promise<void>;
33
+ setPreviewHTML: (html: unknown) => Promise<void>;
34
+ createNotification: (notification: INotification) => Promise<void>;
35
+ setActiveMembers: (activeMembers: string[]) => Promise<void>;
36
+ changeEmailToMobile: () => Promise<void>;
37
+ changeEmailToDesktop: () => Promise<void>;
38
+ toggleHiddenElementsVisibility: () => Promise<void>;
39
+ /** @deprecated Use `toggleHiddenElementsVisibility`. */
40
+ toggleBlocksAndStructuresVisibility: () => Promise<void>;
41
+ updateCustomBlockContent: (content: string) => Promise<void>;
42
+ refreshComments: (key: string) => Promise<void>;
43
+ refreshSyncedSections: () => Promise<void>;
44
+ openPremadeTemplatesSelection: () => Promise<void>;
45
+ /**
46
+ * Update the authorization header of all later API calls. An object is merged into the
47
+ * current header; a `null` value removes that header.
48
+ */
49
+ updateApiAuthorizationHeader: (newHeader: string | Record<string, string | null>) => Promise<void>;
50
+ setTemplateName: (name: string) => Promise<void>;
51
+ updateOptions: (topolOptions: Partial<Omit<IEmailConfig, "authorize">>) => Promise<void>;
52
+ setMergeTags: (mergeTags: Array<IMergeTag | IMergeTagGroup>) => Promise<void>;
53
+ toggleChatAI: () => Promise<void>;
54
+ toggleAutosaves: () => Promise<void>;
55
+ toggleComments: () => Promise<void>;
56
+ createLanguage: (code: string) => Promise<void>;
57
+ setPrimaryLanguage: (code: string) => Promise<void>;
58
+ deleteLanguage: (code: string) => Promise<void>;
59
+ selectLanguage: (code: string) => Promise<void>;
60
+ translateLanguage: (code: string, sourceCode?: string) => Promise<void>;
61
+ translateAllLanguages: () => Promise<void>;
62
+ /** Returns the template's language mutations (also fires onGetMutations). */
63
+ getMutations: () => Promise<ILanguageMutation[]>;
64
+ toggleSelectionPanel: () => Promise<void>;
65
+ /** @deprecated Use `toggleSelectionPanel`. */
66
+ toggleControlPanel: () => Promise<void>;
67
+ updateTemplate: (json: unknown, options?: IUpdateTemplateOptions) => Promise<void>;
68
+ }
@@ -0,0 +1,7 @@
1
+ import type IEmailConfig from "./IEmailConfig";
2
+ import type IEmailCallbacks from "./Callbacks/IEmailCallbacks";
3
+ /** Email Editor v4 factory props. Callbacks live alongside config. */
4
+ export default interface IEmailOptions extends IEmailCallbacks {
5
+ config: IEmailConfig;
6
+ }
7
+ export type { IEmailCallbacks };
@@ -1 +1,6 @@
1
- export type Language = "en" | "fr" | "pt" | "es" | "ja" | "zh" | "ru" | "tr" | "de" | "sv" | "nl" | "it" | "fi" | "ro" | "cs" | "pl" | "ko" | "vi" | "he";
1
+ export type Language = "en" | "fr" | "pt" | "es" | "ja" | "zh" | "ru" | "tr" | "de" | "sv" | "nl" | "it" | "fi" | "ro" | "cs" | "pl" | "ko" | "vi" | "he" | "ar" | "sk";
2
+ export type IMultilingualLanguage = {
3
+ name: string;
4
+ code: string;
5
+ nativeName: string;
6
+ }[];
@@ -1,6 +1,24 @@
1
+ /** A property of the items a merge tag iterates over. */
2
+ export interface IMergeTagChildProperty {
3
+ value: string;
4
+ text: string;
5
+ label: string;
6
+ type?: "image" | "button" | "number" | "text";
7
+ }
8
+ /** A named predefined list of values, insertable at once into a list condition. */
9
+ export interface IMergeTagSuggestionSet {
10
+ name: string;
11
+ values: string[];
12
+ }
1
13
  export default interface IMergeTag {
2
14
  value: string;
3
15
  text: string;
4
16
  label: string;
5
17
  defaultValue?: string;
18
+ parentPath?: string;
19
+ childrenProperties?: IMergeTagChildProperty[] | null;
20
+ /** Values offered when the tag is used in a condition. */
21
+ suggestions?: string[] | null;
22
+ /** Named predefined lists of values, insertable at once into a list condition. */
23
+ suggestionSets?: IMergeTagSuggestionSet[] | null;
6
24
  }
@@ -1,7 +1,8 @@
1
1
  export default interface INotification {
2
- title: string;
2
+ title?: string;
3
3
  text: string;
4
4
  expectSideEffect?: boolean;
5
5
  persistent?: boolean;
6
6
  type: "info" | "error" | "success";
7
+ id?: string | number;
7
8
  }
@@ -0,0 +1,41 @@
1
+ /** Reusable section. Template definitions and translations are opaque JSON. */
2
+ export interface ISavedSection {
3
+ id: number;
4
+ name: string;
5
+ img?: string | null;
6
+ definition: unknown;
7
+ translation?: unknown;
8
+ children?: ISavedSection[];
9
+ }
10
+ /** What `onSavedSectionSave` hands over: the host assigns `id` and `name` before passing it back via `setSavedSections`. */
11
+ export type ISavedSectionDraft = Pick<ISavedSection, "definition" | "translation">;
12
+ export interface IPremadeSection {
13
+ name?: string;
14
+ img?: string;
15
+ definition: unknown;
16
+ translation?: unknown;
17
+ }
18
+ export type IPremadeSections = {
19
+ id?: number;
20
+ name: string;
21
+ blocks: IPremadeSection[];
22
+ }[];
23
+ export interface ILegacyPremadeSections {
24
+ content?: IPremadeSection[];
25
+ ecomm?: IPremadeSection[];
26
+ footers?: IPremadeSection[];
27
+ headers?: IPremadeSection[];
28
+ }
29
+ /** Topol's default premade section groups, in the order the sidebar shows them. */
30
+ export type IPremadePresetId = "header" | "content" | "ecommerce" | "footer";
31
+ /**
32
+ * A reference to one of Topol's default groups. Inside the `blocks` array of the object form it
33
+ * expands, in place, to that group. Each preset can be listed once and takes no other key.
34
+ */
35
+ export interface IPremadePreset {
36
+ preset: IPremadePresetId;
37
+ }
38
+ export type IPremadeSectionsOptions = false | IPremadeSections | ILegacyPremadeSections | {
39
+ blocks: Array<IPremadeSections[number] | IPremadePreset> | ILegacyPremadeSections;
40
+ override: boolean;
41
+ };
@@ -0,0 +1,4 @@
1
+ /** Keyboard shortcuts of the Email Editor that `disableShortcuts` can switch off. */
2
+ export type EmailEditorShortcut = "save" | "saveAndClose" | "undo" | "redo" | "preview" | "developerMode" | "copy" | "escape";
3
+ /** Keyboard shortcuts of the Landing Page Editor that `disableShortcuts` can switch off. */
4
+ export type LandingPageEditorShortcut = "save" | "saveAndClose" | "undo" | "redo" | "preview" | "developerMode" | "escape" | "addBelow" | "delete" | "duplicate" | "cut" | "copy";
@@ -1,10 +1,18 @@
1
1
  export default interface ITheme {
2
- preset: "light" | "dark";
2
+ preset?: "light" | "dark";
3
3
  borderRadius?: {
4
+ extraSmall?: string;
4
5
  small?: string;
5
6
  large?: string;
7
+ extraLarge?: string;
6
8
  };
7
- colors: {
9
+ canvasColor?: string;
10
+ /** Font of the editor UI; `url` points to the stylesheet that loads `family`. */
11
+ font?: {
12
+ family?: string;
13
+ url?: string;
14
+ };
15
+ colors?: {
8
16
  "900"?: string;
9
17
  "800"?: string;
10
18
  "700"?: string;
@@ -31,5 +39,7 @@ export default interface ITheme {
31
39
  active?: string;
32
40
  "active-2"?: string;
33
41
  "active-3"?: string;
42
+ "locked-structure"?: string;
43
+ "locked-content"?: string;
34
44
  };
35
45
  }
@@ -1,23 +1,87 @@
1
+ import type { IPluginOptionsPartial } from "../../src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema";
2
+ import type { INotification } from "../../src/landing-page-editor/schemas/notification/notificationSchema";
1
3
  /**
2
- * Instance of the Landing Page Editor returned by create().
4
+ * Instance of the Landing Page Editor returned by LandingPageEditor.init().
5
+ *
6
+ * The editor runs in an iframe, so every method is forwarded to it and returns a Promise that
7
+ * settles once the editor has processed the call.
8
+ * See https://docs.topol.io/landing-page-editor/reference/topol-plugin
3
9
  */
4
10
  export default interface ILandingPageEditorInstance {
5
11
  /**
6
12
  * Render the editor into a container element.
7
- * @param selector - CSS selector for the container element (e.g., "#landing-page-editor")
13
+ *
14
+ * The returned promise resolves once the editor iframe has been rendered and
15
+ * rejects if the container cannot be found or the instance was destroyed meanwhile.
16
+ *
17
+ * @param container - CSS selector for the container element (e.g., "#landing-page-editor") or the element itself
8
18
  */
9
- render(selector: string): void;
19
+ render(container: string | HTMLElement): Promise<void>;
10
20
  /**
11
- * Load a template into the editor.
12
- * @param template - The template data (JSON structure)
21
+ * Load a template into the editor. Resolves once the template is applied. A template that
22
+ * fails to load is reported to the user in a notification and the Promise still resolves.
23
+ * @param template - The template JSON, as a string or a parsed object
13
24
  */
14
- load(template: unknown): void;
25
+ load(template: unknown): Promise<void>;
15
26
  /**
16
- * Trigger the save callback with current editor content.
27
+ * Render the template, then fire `onSave({ json, html })`. Resolves once the save has
28
+ * settled, including your `onSave` Promise, so the `onSave` fired meanwhile is this call's
29
+ * answer. A failed save still resolves and is reported through `onEditorError` with
30
+ * `source: "save"`.
31
+ *
32
+ * Only one save runs at a time: while another save is running the call fires no `onSave`
33
+ * and rejects with an Error whose `code` is `"SAVE_IN_PROGRESS"`.
17
34
  */
18
- save(): void;
35
+ save(): Promise<void>;
36
+ /** Toggle preview mode on or off. */
37
+ togglePreview(): Promise<void>;
38
+ /** Switch the preview device: `0` mobile, `1` mobile landscape, `2` tablet, `3` desktop (any other value). */
39
+ setPreviewSize(index: number): Promise<void>;
40
+ /** Undo the last change. */
41
+ undo(): Promise<void>;
42
+ /** Redo the last undone change. */
43
+ redo(): Promise<void>;
44
+ /** Hand the file chosen in your custom file manager (`onOpenFileManager`) back to the editor. */
45
+ chooseFile(url: string): Promise<void>;
46
+ /** Reload the synced sections and the placed ones in the template. */
47
+ refreshSyncedSections(): Promise<void>;
48
+ /** Reload the comments of one conversation. */
49
+ refreshComments(key: string): Promise<void>;
50
+ /** Open the premade templates picker. */
51
+ openPremadeTemplatesSelection(): Promise<void>;
52
+ /** Set the template name shown in the editor. */
53
+ setTemplateName(name: string): Promise<void>;
54
+ /**
55
+ * Reconfigure the running editor with any options except `authorize`. Resolves once the
56
+ * options are applied and rejects when they fail validation.
57
+ */
58
+ updateOptions(options: IPluginOptionsPartial): Promise<void>;
59
+ /** Collapse or expand the right-side selection panel. */
60
+ toggleSelectionPanel(): Promise<void>;
61
+ /** Open or close the autosaves panel. Does nothing while `enableAutosaves` is off. */
62
+ toggleAutosaves(): Promise<void>;
63
+ /** Open or close the comments panel. Does nothing while `enableComments` is off. */
64
+ toggleComments(): Promise<void>;
65
+ /** Replace the presence list shown in the top bar. A display indicator, not co-editing. */
66
+ setActiveMembers(activeMembers: string[]): Promise<void>;
67
+ /**
68
+ * Replace the content of the custom block whose dialog was last opened through
69
+ * `onOpenCustomBlockDialog`. Rejects when `content` is not a string.
70
+ */
71
+ updateCustomBlockContent(content: string): Promise<void>;
72
+ /**
73
+ * Update the authorization header of all later API calls. An object is merged into the
74
+ * current header; a `null` value removes that header.
75
+ */
76
+ updateApiAuthorizationHeader(newHeader: string | Record<string, string | null>): Promise<void>;
77
+ /** Show a notification in the editor. Shown even with `disableAlerts` and never forwarded to `onAlert`. */
78
+ createNotification(notification: INotification): Promise<void>;
19
79
  /**
20
80
  * Destroy the editor instance and clean up resources.
21
81
  */
22
- destroy(): void;
82
+ destroy(): Promise<void>;
83
+ /**
84
+ * Alias of destroy(), the name the script-tag instance has always had.
85
+ */
86
+ close(): Promise<void>;
23
87
  }