@topol.io/editor 1.0.0-alpha.10 → 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.
- package/README.md +17 -14
- package/dist/topol-plugin.es.js +109 -95
- package/dist/topol-plugin.umd.cjs +1 -1
- package/dist/types/src/email-editor/index.d.ts +3 -3
- package/dist/types/src/landing-page-editor/constants.d.ts +1 -1
- package/dist/types/src/landing-page-editor/index.d.ts +10 -5
- package/dist/types/src/landing-page-editor/schemas/api/apiSchema.d.ts +5 -10
- package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +33 -17
- package/dist/types/src/landing-page-editor/schemas/language/languageSchema.d.ts +1 -1
- package/dist/types/src/landing-page-editor/schemas/mjmlStore/mjmlStoreSchema.d.ts +8 -6
- package/dist/types/src/landing-page-editor/schemas/notification/notificationSchema.d.ts +0 -1
- package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +66 -19
- package/dist/types/src/landing-page-editor/schemas/premadeSection/premadeSectionSchema.d.ts +30 -0
- package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +685 -3
- package/dist/types/src/landing-page-editor/schemas/template/blocks/carouselBlockSchema.d.ts +9 -2
- package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +9 -1
- package/dist/types/src/landing-page-editor/schemas/template/blocks/formBlockSchema.d.ts +1069 -0
- package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +29 -13
- package/dist/types/src/landing-page-editor/schemas/template/blocks/rawBlockSchema.d.ts +9 -1
- package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +9 -1
- package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +16 -8
- package/dist/types/src/landing-page-editor/schemas/template/blocks/textBlockSchema.d.ts +9 -1
- package/dist/types/src/landing-page-editor/schemas/template/blocks/videoBlockSchema.d.ts +9 -1
- package/dist/types/src/landing-page-editor/schemas/template/commonSchema.d.ts +28 -8
- package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarCTASchema.d.ts +335 -0
- package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarHamburgerSchema.d.ts +1109 -0
- package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarLogoSchema.d.ts +252 -0
- package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarMenuSchema.d.ts +1209 -0
- package/dist/types/src/landing-page-editor/schemas/template/settingsSchema.d.ts +4058 -546
- package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +4675 -1996
- package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +5445 -2356
- package/dist/types/src/landing-page-editor/schemas/template/structure/navbarSchema.d.ts +4394 -0
- package/dist/types/src/landing-page-editor/schemas/template/structure/rowSchema.d.ts +11094 -0
- package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +8365 -3100
- package/dist/types/src/landing-page-editor/schemas/template/styleSchema.d.ts +55 -44
- package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +34901 -48500
- package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4305 -794
- package/dist/types/src/landing-page-editor/schemas/theme/themeSchema.d.ts +6 -1
- package/dist/types/src/landing-page-editor/schemas/utils/cssValue.d.ts +21 -0
- package/dist/types/src/landing-page-editor/schemas/utils/transformBorder.d.ts +10 -5
- package/dist/types/src/main.d.ts +23 -42
- package/dist/types/types/API/API.d.ts +2 -2
- package/dist/types/types/APIBlocks/APIBlocks.d.ts +11 -0
- package/dist/types/types/Auth/IAuthorize.d.ts +18 -0
- package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +2 -1
- package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +11 -4
- package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +30 -10
- package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
- package/dist/types/types/Countdown/ICountdownOptions.d.ts +2 -2
- package/dist/types/types/IEmailConfig.d.ts +44 -18
- package/dist/types/types/IEmailEditorInstance.d.ts +16 -2
- package/dist/types/types/{ITopolOptions.d.ts → IEmailOptions.d.ts} +1 -1
- package/dist/types/types/MergeTag/IMergeTag.d.ts +18 -0
- package/dist/types/types/Notification/INotification.d.ts +2 -1
- package/dist/types/types/Sections/ISections.d.ts +12 -1
- package/dist/types/types/Shortcuts/EditorShortcut.d.ts +4 -0
- package/dist/types/types/Theme/ITheme.d.ts +12 -2
- package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +65 -5
- package/dist/types/types/landing-page/ILandingPageOptions.d.ts +20 -10
- package/package.json +1 -1
- package/dist/types/src/landing-page-editor/schemas/helpdesk/helpdeskSchema.d.ts +0 -8
- package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +0 -59750
- package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +0 -44831
- package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +0 -59725
- package/dist/types/src/landing-page-editor/schemas/template/blocks/index.d.ts +0 -12
- package/dist/types/types/ITopolPlugin.d.ts +0 -2
- package/dist/types/types/SavedBlock/ISavedBlock.d.ts +0 -2
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export default interface ITheme {
|
|
2
|
-
preset
|
|
2
|
+
preset?: "light" | "dark";
|
|
3
3
|
borderRadius?: {
|
|
4
|
+
extraSmall?: string;
|
|
4
5
|
small?: string;
|
|
5
6
|
large?: string;
|
|
7
|
+
extraLarge?: string;
|
|
6
8
|
};
|
|
7
|
-
|
|
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
|
-
*
|
|
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
|
-
*
|
|
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
|
-
|
|
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
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Re-exports the IPluginOptions from the schema with additional callbacks.
|
|
2
|
+
* Options of `LandingPageEditor.init()`: the editor `config` plus the host callbacks.
|
|
4
3
|
*/
|
|
5
|
-
import type {
|
|
4
|
+
import type { ILandingPageConfig } from "../../src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema";
|
|
6
5
|
import type { INotification } from "../../src/landing-page-editor/schemas/notification/notificationSchema";
|
|
6
|
+
import type { EditorErrorSource } from "../Callbacks/ICallbackPayloads";
|
|
7
|
+
import type { INonceAuthCallbacks } from "../Auth/INonceAuthCallbacks";
|
|
7
8
|
/**
|
|
8
9
|
* Payload of `onSave` and `onSaveAndClose`.
|
|
9
10
|
*/
|
|
@@ -12,6 +13,8 @@ export interface ILandingPageSavePayload {
|
|
|
12
13
|
json: unknown;
|
|
13
14
|
/** The rendered page HTML. */
|
|
14
15
|
html: string;
|
|
16
|
+
/** Ids of the synced sections placed in the saved template. */
|
|
17
|
+
syncedSections?: number[];
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* A file or folder deleted in the built-in file manager (`onImageDelete`).
|
|
@@ -27,8 +30,8 @@ export interface ILandingPageDeletedItem {
|
|
|
27
30
|
* Payload of `onEditorError`.
|
|
28
31
|
*/
|
|
29
32
|
export interface ILandingPageErrorPayload {
|
|
30
|
-
/** Where the error originated. `"
|
|
31
|
-
source:
|
|
33
|
+
/** Where the error originated. The wrappers report `"integration"` when `init()` or `render()` rejects. */
|
|
34
|
+
source: EditorErrorSource;
|
|
32
35
|
/** Human-readable description. */
|
|
33
36
|
message: string;
|
|
34
37
|
/** Raw error data when available (for `network` errors, the response body). */
|
|
@@ -40,9 +43,9 @@ export interface ILandingPageErrorPayload {
|
|
|
40
43
|
* Every callback receives at most one argument: a payload object with named
|
|
41
44
|
* properties. New fields can be added to a payload without breaking handlers,
|
|
42
45
|
* so destructure what you need and ignore the rest. Callbacks that carry no
|
|
43
|
-
* data are called with no arguments.
|
|
46
|
+
* data are called with no arguments. The one exception is `getNonce`, which returns a value.
|
|
44
47
|
*/
|
|
45
|
-
export interface ILandingPageCallbacks {
|
|
48
|
+
export interface ILandingPageCallbacks extends INonceAuthCallbacks {
|
|
46
49
|
/**
|
|
47
50
|
* Called when the user saves the landing page.
|
|
48
51
|
* May return a Promise: the editor keeps its saving state until it settles and a
|
|
@@ -114,7 +117,14 @@ export interface ILandingPageCallbacks {
|
|
|
114
117
|
*/
|
|
115
118
|
onEditorClose?(): void | Promise<void>;
|
|
116
119
|
/**
|
|
117
|
-
* Called when the unsaved-changes state flips. `
|
|
120
|
+
* Called when the unsaved-changes state flips. `hasUnsavedChanges` is `true` while there are unsaved edits.
|
|
121
|
+
*/
|
|
122
|
+
onUnsavedChangesChange?(payload: {
|
|
123
|
+
hasUnsavedChanges: boolean;
|
|
124
|
+
}): void;
|
|
125
|
+
/**
|
|
126
|
+
* @deprecated Use `onUnsavedChangesChange`. Fires alongside it with `{ value }`; the editor logs a
|
|
127
|
+
* deprecation warning when it is passed.
|
|
118
128
|
*/
|
|
119
129
|
onEdittedWithoutSaveChanged?(payload: {
|
|
120
130
|
value: boolean;
|
|
@@ -146,7 +156,7 @@ export default interface ILandingPageOptions extends ILandingPageCallbacks {
|
|
|
146
156
|
/**
|
|
147
157
|
* Editor configuration options.
|
|
148
158
|
*/
|
|
149
|
-
config:
|
|
159
|
+
config: ILandingPageConfig;
|
|
150
160
|
}
|
|
151
|
-
export type {
|
|
161
|
+
export type { ILandingPageConfig };
|
|
152
162
|
export type { LambdaStage, UserRole } from "../../src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema";
|
package/package.json
CHANGED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const HelpSchema: z.ZodObject<{
|
|
3
|
-
text: z.ZodString;
|
|
4
|
-
url: z.ZodString;
|
|
5
|
-
}, z.core.$strip>;
|
|
6
|
-
export declare const HelpdeskSchema: z.ZodObject<{}, z.core.$strip>;
|
|
7
|
-
export type IHelp = z.infer<typeof HelpSchema>;
|
|
8
|
-
export type IHelpdesk = z.infer<typeof HelpdeskSchema>;
|