@topol.io/editor 1.0.0-alpha.8 → 1.0.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.
Files changed (72) hide show
  1. package/README.md +160 -97
  2. package/dist/index.js +171 -0
  3. package/dist/types/src/email-editor/index.d.ts +16 -102
  4. package/dist/types/src/landing-page-editor/constants.d.ts +1 -1
  5. package/dist/types/src/landing-page-editor/index.d.ts +11 -6
  6. package/dist/types/src/landing-page-editor/schemas/api/apiSchema.d.ts +5 -11
  7. package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +34 -18
  8. package/dist/types/src/landing-page-editor/schemas/language/languageSchema.d.ts +1 -1
  9. package/dist/types/src/landing-page-editor/schemas/mjmlStore/mjmlStoreSchema.d.ts +8 -6
  10. package/dist/types/src/landing-page-editor/schemas/notification/notificationSchema.d.ts +0 -1
  11. package/dist/types/src/landing-page-editor/schemas/openAI/openAISchema.d.ts +1 -2
  12. package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +150 -17
  13. package/dist/types/src/landing-page-editor/schemas/premadeSection/premadeSectionSchema.d.ts +30 -0
  14. package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +687 -5
  15. package/dist/types/src/landing-page-editor/schemas/template/blocks/carouselBlockSchema.d.ts +9 -2
  16. package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +11 -3
  17. package/dist/types/src/landing-page-editor/schemas/template/blocks/formBlockSchema.d.ts +1069 -0
  18. package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +35 -19
  19. package/dist/types/src/landing-page-editor/schemas/template/blocks/rawBlockSchema.d.ts +9 -1
  20. package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +11 -3
  21. package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +18 -10
  22. package/dist/types/src/landing-page-editor/schemas/template/blocks/textBlockSchema.d.ts +9 -1
  23. package/dist/types/src/landing-page-editor/schemas/template/blocks/videoBlockSchema.d.ts +9 -1
  24. package/dist/types/src/landing-page-editor/schemas/template/commonSchema.d.ts +28 -8
  25. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarCTASchema.d.ts +335 -0
  26. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarHamburgerSchema.d.ts +1109 -0
  27. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarLogoSchema.d.ts +252 -0
  28. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarMenuSchema.d.ts +1209 -0
  29. package/dist/types/src/landing-page-editor/schemas/template/settingsSchema.d.ts +4058 -546
  30. package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +5007 -2328
  31. package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +5501 -2412
  32. package/dist/types/src/landing-page-editor/schemas/template/structure/navbarSchema.d.ts +4394 -0
  33. package/dist/types/src/landing-page-editor/schemas/template/structure/rowSchema.d.ts +11094 -0
  34. package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +8602 -3337
  35. package/dist/types/src/landing-page-editor/schemas/template/styleSchema.d.ts +55 -44
  36. package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +34865 -48464
  37. package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4304 -794
  38. package/dist/types/src/landing-page-editor/schemas/theme/themeSchema.d.ts +6 -1
  39. package/dist/types/src/landing-page-editor/schemas/utils/cssValue.d.ts +21 -0
  40. package/dist/types/src/landing-page-editor/schemas/utils/transformBorder.d.ts +10 -5
  41. package/dist/types/src/main.d.ts +28 -108
  42. package/dist/types/types/API/API.d.ts +8 -9
  43. package/dist/types/types/APIBlocks/APIBlocks.d.ts +9 -0
  44. package/dist/types/types/Auth/IAuthorize.d.ts +6 -0
  45. package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +10 -0
  46. package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +27 -23
  47. package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +73 -155
  48. package/dist/types/types/Cloud/ICloudOptions.d.ts +32 -0
  49. package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
  50. package/dist/types/types/Countdown/ICountdownOptions.d.ts +48 -0
  51. package/dist/types/types/{ITopolOptions.d.ts → IEmailConfig.d.ts} +80 -28
  52. package/dist/types/types/IEmailEditorInstance.d.ts +64 -0
  53. package/dist/types/types/IEmailOptions.d.ts +7 -0
  54. package/dist/types/types/Language/Language.d.ts +1 -1
  55. package/dist/types/types/MergeTag/IMergeTag.d.ts +18 -0
  56. package/dist/types/types/Notification/INotification.d.ts +2 -1
  57. package/dist/types/types/Sections/ISections.d.ts +41 -0
  58. package/dist/types/types/Shortcuts/EditorShortcut.d.ts +4 -0
  59. package/dist/types/types/Theme/ITheme.d.ts +12 -2
  60. package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +65 -5
  61. package/dist/types/types/landing-page/ILandingPageOptions.d.ts +105 -69
  62. package/logo.svg +1 -0
  63. package/package.json +11 -13
  64. package/dist/topol-plugin.es.js +0 -284
  65. package/dist/topol-plugin.umd.js +0 -1
  66. package/dist/types/src/landing-page-editor/schemas/helpdesk/helpdeskSchema.d.ts +0 -8
  67. package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +0 -59750
  68. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +0 -44831
  69. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +0 -59725
  70. package/dist/types/src/landing-page-editor/schemas/template/blocks/index.d.ts +0 -12
  71. package/dist/types/types/ITopolPlugin.d.ts +0 -44
  72. package/dist/types/types/SavedBlock/ISavedBlock.d.ts +0 -6
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Palette of newly created countdowns. Any subset of `background`, `digits`, `labels`
3
+ * and `accent` as hex colors (`#RGB`, `#RRGGBB` or `#RRGGBBAA`); unset colors keep the
4
+ * editor defaults (white background, black text, purple accent).
5
+ */
6
+ export interface ICountdownDefaultColors {
7
+ background?: string;
8
+ digits?: string;
9
+ labels?: string;
10
+ accent?: string;
11
+ }
12
+ /**
13
+ * A merge tag of your ESP that can supply the end date of a dynamic countdown.
14
+ * The `value` goes into the countdown image URL verbatim (`?end_date_time={tag}`)
15
+ * and must produce an RFC 3339 date once the ESP substitutes it.
16
+ */
17
+ export interface ICountdownDateMergeTag {
18
+ /** Name shown to the user when picking the tag. */
19
+ label: string;
20
+ /**
21
+ * The tag itself. `{seconds}` in it is replaced with the countdown length the user
22
+ * sets (e.g. `*|SEND_DATE+{seconds}|*`); without it the tag is inserted as is
23
+ * (e.g. `*|RESERVATION_UNTIL|*`). At most 200 characters, no quotes, `<`, `>` or `&`.
24
+ */
25
+ value: string;
26
+ }
27
+ /**
28
+ * Countdown block settings of the host. The block itself is gated by the add-on flag
29
+ * in the editor nonce. See https://docs.topol.io/email-editor/reference/topol-options#countdown
30
+ */
31
+ export interface ICountdownOptions {
32
+ /** Palette of newly created countdowns (any subset); unset colors keep the package defaults. */
33
+ defaultColors?: ICountdownDefaultColors;
34
+ /** Base URL of a custom style thumbnail set: the editor loads `{base}/{style}.gif` for every countdown style. */
35
+ styleThumbnailBase?: string;
36
+ /**
37
+ * Merge tag the evergreen countdowns' recipient key is rendered with (verbatim, no quotes).
38
+ * Use a value that is stable and unique per recipient, ideally a contact ID
39
+ * (e.g. `*|CONTACT_ID|*`). Unset = the recipient's email address in the syntax of
40
+ * `emailServiceProvider`. At most 100 characters.
41
+ */
42
+ mergeTag?: string;
43
+ /**
44
+ * Merge tags a dynamic countdown's deadline (`end_date_time`) can come from;
45
+ * `{seconds}` in a value = the countdown length the user sets. Unset = no dynamic mode.
46
+ */
47
+ dateMergeTags?: ICountdownDateMergeTag[];
48
+ }
@@ -1,8 +1,11 @@
1
+ import type { IAuthorize } from "./Auth/IAuthorize";
1
2
  import type IAPI from "./API/API";
2
3
  import type IAPIBlockProperties from "./APIBlocks/APIBlocks";
3
- import type ISavedBlock from "./SavedBlock/ISavedBlock";
4
+ import type { ISavedSection, IPremadeSectionsOptions } from "./Sections/ISections";
5
+ import type { ICloudOptions } from "./Cloud/ICloudOptions";
4
6
  import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
5
7
  import type { IContentBlockOptions } from "./ContentBlock/IContentBlockOptions";
8
+ import type { ICountdownOptions } from "./Countdown/ICountdownOptions";
6
9
  import type ITheme from "./Theme/ITheme";
7
10
  import type IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
8
11
  import type IFont from "./Font/IFont";
@@ -12,21 +15,18 @@ import type IMergeTag from "./MergeTag/IMergeTag";
12
15
  import type SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
13
16
  import type IUser from "./User/User";
14
17
  import type IHelpdesk from "./Helpdesk/Helpdesk";
15
- import type IEmailCallbacks from "./Callbacks/IEmailCallbacks";
18
+ import type { EmailEditorShortcut } from "./Shortcuts/EditorShortcut";
16
19
  type TopolTagAttribute = "font-family" | "font-size" | "font-weight" | "font-style" | "letter-spacing" | "text-transform" | "text-decoration" | "background-color" | "color" | "border-collapse";
17
20
  type DefaultTemplateLangsSchema = {
18
- key: string;
21
+ code: string;
19
22
  primary: boolean;
20
23
  }[];
21
24
  /**
22
- * Configuration options for the Email Editor (TopolPlugin).
25
+ * Configuration options for the Email Editor: the `config` of `EmailEditor.init({ config, ...callbacks })`.
23
26
  */
24
- export default interface ITopolOptions {
25
- id: string;
26
- authorize: {
27
- apiKey: string;
28
- userId: string | number;
29
- };
27
+ export default interface IEmailConfig {
28
+ authorize: IAuthorize;
29
+ aiLabeledElements?: boolean;
30
30
  api?: IAPI;
31
31
  apiAuthorizationHeader?: IAuthHeaderConfig | string;
32
32
  apiBlocks?: Record<string, IAPIBlockProperties>;
@@ -34,10 +34,23 @@ export default interface ITopolOptions {
34
34
  betaFeatures?: {
35
35
  carousel?: boolean;
36
36
  loop?: boolean;
37
+ rating?: boolean;
37
38
  };
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;
39
50
  colors?: Array<string>;
40
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;
41
54
  currentUser?: IUser;
42
55
  customBlocks?: ICustomBlockData[];
43
56
  customFileManager?: boolean;
@@ -52,7 +65,8 @@ export default interface ITopolOptions {
52
65
  defaultTemplateSettings?: {
53
66
  emailWidth?: number;
54
67
  emailBackgroundColor?: string;
55
- blockBackgroundColor?: string;
68
+ /** Background color of sections. */
69
+ sectionBackgroundColor?: string;
56
70
  buttonsBackgroundColor?: string;
57
71
  hyperlinkColor?: string;
58
72
  h1?: {
@@ -67,21 +81,33 @@ export default interface ITopolOptions {
67
81
  p?: {
68
82
  [key in TopolTagAttribute]?: string;
69
83
  };
70
- button?: {
71
- [key in TopolTagAttribute]?: string;
72
- };
73
- "line-height"?: number;
74
- "structure-margin"?: string;
75
- "stack-columns"?: boolean;
84
+ button?: Record<string, unknown>;
85
+ carousel?: Record<string, unknown>;
86
+ divider?: Record<string, unknown>;
87
+ gif?: Record<string, unknown>;
88
+ image?: Record<string, unknown>;
89
+ loop?: Record<string, unknown>;
90
+ social?: Record<string, unknown>;
91
+ text?: Record<string, unknown>;
92
+ column?: Record<string, unknown>;
93
+ section?: Record<string, unknown>;
94
+ /** Padding of sections. */
95
+ sectionPadding?: string;
96
+ lineHeight?: number;
97
+ stackColumns?: boolean;
76
98
  langs?: DefaultTemplateLangsSchema;
77
99
  };
78
100
  disableAiAssistant?: boolean;
79
101
  disableAlerts?: boolean;
80
102
  disableExtendedComparators?: boolean;
81
- emailServiceProvider?: "mailchimp" | "sparkpost";
103
+ /** `true` turns every editor keyboard shortcut off; an array only the listed ones. */
104
+ disableShortcuts?: boolean | EmailEditorShortcut[];
105
+ emailServiceProvider?: "mailchimp" | "sparkpost" | "jinja";
82
106
  enableAutosaves?: boolean;
83
107
  enableComments?: boolean;
84
108
  enableDarkMode?: boolean;
109
+ enableFileManagerInGif?: boolean;
110
+ enableSubjectLine?: boolean;
85
111
  enableImageToTextRatio?: boolean;
86
112
  enableMergeTagPreview?: boolean;
87
113
  enableSectionVariants?: boolean;
@@ -89,12 +115,14 @@ export default interface ITopolOptions {
89
115
  fileManagerPreferences?: {
90
116
  defaultTilesView?: boolean;
91
117
  hidePexelsIntegration?: boolean;
118
+ maxUploadingFiles?: number;
92
119
  };
93
120
  fontSizes?: Array<number>;
94
- googleApiKey?: string;
121
+ googlePromotionalAnnotation?: boolean;
95
122
  helpdesk?: IHelpdesk;
96
123
  hideSettingsTab?: boolean;
97
- hideControlPanel?: boolean;
124
+ hideSelectionPanel?: boolean;
125
+ hideSelectionPanelExpand?: boolean;
98
126
  htmlDesktopFirst?: boolean;
99
127
  htmlMinified?: boolean;
100
128
  imageCompressionOptions?: {
@@ -108,25 +136,48 @@ export default interface ITopolOptions {
108
136
  hideControls?: Array<string>;
109
137
  };
110
138
  imageMaxSize?: number;
139
+ lambdaStage?: "local" | "production" | "stage1" | "stage2" | "stage3";
111
140
  language?: Language;
141
+ languageMergeTag?: string;
112
142
  light?: boolean;
113
143
  logicalOperatorsInsideVariant?: boolean;
114
144
  mainMenuAlign?: "left" | "right";
115
145
  mergeTags?: Array<IMergeTagGroup | IMergeTag>;
116
146
  mobileFirstEnabled?: boolean;
117
147
  multilingual?: boolean;
118
- premadeBlocks?: Record<any, any> | boolean;
119
- premadeBlocksNoOverwrite?: boolean;
148
+ premadeSections?: IPremadeSectionsOptions;
120
149
  premadeTemplates?: boolean;
121
150
  premadeTemplatesOptions?: {
122
151
  hideSearch?: boolean;
123
152
  showDelete?: boolean;
124
153
  };
154
+ productMergeTags?: {
155
+ label: string;
156
+ value: string;
157
+ }[];
158
+ permissions?: {
159
+ canLockBlocks?: boolean;
160
+ canLockSections?: boolean;
161
+ canEditLockedSections?: boolean;
162
+ canEditLockedBlocks?: boolean;
163
+ canRemoveFiles?: boolean;
164
+ };
165
+ ecm?: {
166
+ articleFeeds?: string;
167
+ articles?: string;
168
+ dataFeeds?: string;
169
+ showArticleBlock?: boolean;
170
+ };
125
171
  removeTopBar?: boolean;
172
+ /**
173
+ * How Save and Save & Close are laid out when both are visible: `"dropdown"` (default) tucks
174
+ * Save & Close under the Save button's menu, `"separate"` renders two standalone buttons.
175
+ * Ignored when either button is hidden via `hideTopbarControls`.
176
+ */
177
+ saveAndCloseButton?: "dropdown" | "separate";
126
178
  renameTemplate?: boolean;
127
179
  role?: "manager" | "editor" | "reader";
128
- savedBlocks?: Array<ISavedBlock> | boolean;
129
- showControlPanelExpand?: boolean;
180
+ savedSections?: ISavedSection[] | boolean | null;
130
181
  showUnsavedDialogBeforeExit?: boolean;
131
182
  smartMergeTags?: {
132
183
  enabled: boolean;
@@ -136,7 +187,8 @@ export default interface ITopolOptions {
136
187
  end: string;
137
188
  };
138
189
  };
139
- syncedRowsEnable?: boolean;
190
+ startWithOpenElementsPanel?: boolean;
191
+ syncedSectionsEnabled?: boolean;
140
192
  teamUsers?: IUser[];
141
193
  templateId?: number | string;
142
194
  testingEmails?: boolean | string[];
@@ -147,10 +199,10 @@ export default interface ITopolOptions {
147
199
  tinyConfig?: unknown;
148
200
  tiptapConfig?: {
149
201
  light?: boolean;
202
+ showMergeTagText?: boolean;
150
203
  };
151
204
  title?: string;
152
- topBarOptions?: Array<string>;
205
+ hideTopbarControls?: string[];
153
206
  windowBar?: Array<string>;
154
- callbacks: IEmailCallbacks;
155
207
  }
156
- export type { IEmailCallbacks };
208
+ export {};
@@ -0,0 +1,64 @@
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
+ updateCustomBlockContent: (content: string) => Promise<void>;
40
+ refreshComments: (key: string) => Promise<void>;
41
+ refreshSyncedSections: () => Promise<void>;
42
+ openPremadeTemplatesSelection: () => Promise<void>;
43
+ /**
44
+ * Update the authorization header of all later API calls. An object is merged into the
45
+ * current header; a `null` value removes that header.
46
+ */
47
+ updateApiAuthorizationHeader: (newHeader: string | Record<string, string | null>) => Promise<void>;
48
+ setTemplateName: (name: string) => Promise<void>;
49
+ updateOptions: (topolOptions: Partial<Omit<IEmailConfig, "authorize">>) => Promise<void>;
50
+ setMergeTags: (mergeTags: Array<IMergeTag | IMergeTagGroup>) => Promise<void>;
51
+ toggleChatAI: () => Promise<void>;
52
+ toggleAutosaves: () => Promise<void>;
53
+ toggleComments: () => Promise<void>;
54
+ createLanguage: (code: string) => Promise<void>;
55
+ setPrimaryLanguage: (code: string) => Promise<void>;
56
+ deleteLanguage: (code: string) => Promise<void>;
57
+ selectLanguage: (code: string) => Promise<void>;
58
+ translateLanguage: (code: string, sourceCode?: string) => Promise<void>;
59
+ translateAllLanguages: () => Promise<void>;
60
+ /** Returns the template's language mutations (also fires onGetMutations). */
61
+ getMutations: () => Promise<ILanguageMutation[]>;
62
+ toggleSelectionPanel: () => Promise<void>;
63
+ updateTemplate: (json: unknown, options?: IUpdateTemplateOptions) => Promise<void>;
64
+ }
@@ -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,4 +1,4 @@
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
2
  export type IMultilingualLanguage = {
3
3
  name: string;
4
4
  code: string;
@@ -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,5 +1,11 @@
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
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
  /**
@@ -12,16 +18,70 @@ export default interface ILandingPageEditorInstance {
12
18
  */
13
19
  render(container: string | HTMLElement): Promise<void>;
14
20
  /**
15
- * Load a template into the editor.
16
- * @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
17
24
  */
18
- load(template: unknown): void;
25
+ load(template: unknown): Promise<void>;
19
26
  /**
20
- * 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"`.
34
+ */
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.
21
70
  */
22
- save(): void;
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>;
23
79
  /**
24
80
  * Destroy the editor instance and clean up resources.
25
81
  */
26
82
  destroy(): Promise<void>;
83
+ /**
84
+ * Alias of destroy(), the name the script-tag instance has always had.
85
+ */
86
+ close(): Promise<void>;
27
87
  }