@topol.io/editor 1.0.0-alpha.9 → 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.
- package/README.md +160 -97
- package/dist/index.js +171 -0
- package/dist/types/src/email-editor/index.d.ts +16 -102
- 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 -11
- package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +34 -18
- 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/openAI/openAISchema.d.ts +1 -2
- package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +65 -21
- 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 +687 -5
- 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 +11 -3
- 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 +35 -19
- 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 +11 -3
- package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +18 -10
- 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 +5007 -2328
- package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +5501 -2412
- 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 +8602 -3337
- 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 +34865 -48464
- package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4304 -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 +28 -108
- package/dist/types/types/API/API.d.ts +8 -9
- package/dist/types/types/APIBlocks/APIBlocks.d.ts +9 -0
- package/dist/types/types/Auth/IAuthorize.d.ts +6 -0
- package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +10 -0
- package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +27 -23
- package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +73 -155
- package/dist/types/types/Cloud/ICloudOptions.d.ts +32 -0
- package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
- package/dist/types/types/Countdown/ICountdownOptions.d.ts +48 -0
- package/dist/types/types/{ITopolOptions.d.ts → IEmailConfig.d.ts} +80 -28
- package/dist/types/types/IEmailEditorInstance.d.ts +64 -0
- package/dist/types/types/IEmailOptions.d.ts +7 -0
- package/dist/types/types/Language/Language.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 +41 -0
- 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 +15 -12
- package/logo.svg +1 -0
- package/package.json +11 -13
- package/dist/topol-plugin.es.js +0 -277
- package/dist/topol-plugin.umd.js +0 -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 -44
- package/dist/types/types/SavedBlock/ISavedBlock.d.ts +0 -6
|
@@ -2,10 +2,16 @@ import z from "zod";
|
|
|
2
2
|
export declare const ThemeSchema: z.ZodObject<{
|
|
3
3
|
preset: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"light">, z.ZodLiteral<"dark">]>>;
|
|
4
4
|
borderRadius: z.ZodOptional<z.ZodObject<{
|
|
5
|
+
extraSmall: z.ZodOptional<z.ZodString>;
|
|
5
6
|
small: z.ZodOptional<z.ZodString>;
|
|
6
7
|
large: z.ZodOptional<z.ZodString>;
|
|
8
|
+
extraLarge: z.ZodOptional<z.ZodString>;
|
|
7
9
|
}, z.core.$strip>>;
|
|
8
10
|
canvasColor: z.ZodOptional<z.ZodString>;
|
|
11
|
+
font: z.ZodOptional<z.ZodObject<{
|
|
12
|
+
family: z.ZodOptional<z.ZodString>;
|
|
13
|
+
url: z.ZodOptional<z.ZodString>;
|
|
14
|
+
}, z.core.$strip>>;
|
|
9
15
|
colors: z.ZodOptional<z.ZodObject<{
|
|
10
16
|
"900": z.ZodOptional<z.ZodString>;
|
|
11
17
|
"800": z.ZodOptional<z.ZodString>;
|
|
@@ -22,7 +28,6 @@ export declare const ThemeSchema: z.ZodObject<{
|
|
|
22
28
|
primary: z.ZodOptional<z.ZodString>;
|
|
23
29
|
"primary-light": z.ZodOptional<z.ZodString>;
|
|
24
30
|
"primary-light-2": z.ZodOptional<z.ZodString>;
|
|
25
|
-
"primary-dark": z.ZodOptional<z.ZodString>;
|
|
26
31
|
secondary: z.ZodOptional<z.ZodString>;
|
|
27
32
|
"secondary-light": z.ZodOptional<z.ZodString>;
|
|
28
33
|
"secondary-light-2": z.ZodOptional<z.ZodString>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Rules for turning template attribute values into CSS declarations. Any code
|
|
3
|
+
* that writes styles from template attributes should use them, so the canvas
|
|
4
|
+
* and the published page agree on units and on which values are emitted.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Whether an attribute value should produce a CSS declaration. Zero is a real
|
|
8
|
+
* value (`opacity: 0`, `padding: 0`), so only missing and empty values are
|
|
9
|
+
* skipped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function hasCssValue(value: unknown): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* A length as CSS: a number or a bare numeric string gets `px`, anything that
|
|
14
|
+
* already carries a unit (or is a keyword such as `auto`) is kept as it is.
|
|
15
|
+
*/
|
|
16
|
+
export declare function toCssLength(value: string | number | null | undefined): string | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* The CSS value for `property`: numbers become px lengths, except for
|
|
19
|
+
* properties that are unitless.
|
|
20
|
+
*/
|
|
21
|
+
export declare function toCssValue<T>(property: string, value: T): T | string;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
* Transform border shorthand properties to individual border-width, border-style, border-color
|
|
3
|
-
* Handles border, border-top, border-bottom, border-left, border-right
|
|
4
|
-
*/
|
|
5
|
-
export default function transformBorder(border?: string | null, borderTop?: string | null, borderBottom?: string | null, borderLeft?: string | null, borderRight?: string | null): {
|
|
1
|
+
type BorderParts = {
|
|
6
2
|
width?: string;
|
|
7
3
|
style?: string;
|
|
8
4
|
color?: string;
|
|
9
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Parses a `border` shorthand by classifying each token rather than by
|
|
8
|
+
* position: legacy templates store both `width style color` (standard CSS)
|
|
9
|
+
* and `width color style`. Splits on spaces outside parentheses so colors
|
|
10
|
+
* like `rgb(0, 0, 0)` stay one token.
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseBorderShorthand(value?: string | null): BorderParts;
|
|
13
|
+
declare const _default: (common?: string | null, top?: string | null, bottom?: string | null, left?: string | null, right?: string | null) => BorderParts;
|
|
14
|
+
export default _default;
|
package/dist/types/src/main.d.ts
CHANGED
|
@@ -1,108 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
* authorize: { apiKey: 'your-key', userId: 'user-123' },
|
|
30
|
-
* callbacks: { onSave(data) { console.log('Saved'); } }
|
|
31
|
-
* });
|
|
32
|
-
* editor.render('#landing-page-editor');
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
import { EmailEditor } from "./email-editor";
|
|
36
|
-
/**
|
|
37
|
-
* @deprecated Use `EmailEditor` instead. `TopolPlugin` is an alias for backwards compatibility.
|
|
38
|
-
*
|
|
39
|
-
* TopolPlugin is the original name for the Email Editor integration.
|
|
40
|
-
* New code should use `EmailEditor` for clarity.
|
|
41
|
-
*/
|
|
42
|
-
declare const TopolPlugin: {
|
|
43
|
-
init: (topolOptions: ITopolOptions, options?: import("./email-editor").EmailEditorPluginOptions | undefined) => Promise<string | boolean>;
|
|
44
|
-
save: (lang?: string | undefined) => void;
|
|
45
|
-
load: (json: unknown) => void;
|
|
46
|
-
togglePreview: () => void;
|
|
47
|
-
togglePreviewSize: () => void;
|
|
48
|
-
chooseFile: (url: string) => void;
|
|
49
|
-
undo: () => void;
|
|
50
|
-
redo: () => void;
|
|
51
|
-
destroy: () => void;
|
|
52
|
-
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
53
|
-
setPreviewHTML: (html: unknown) => void;
|
|
54
|
-
createNotification: (notification: INotification) => void;
|
|
55
|
-
setActiveMembers: (activeMembers: string[]) => void;
|
|
56
|
-
changeEmailToMobile: () => void;
|
|
57
|
-
changeEmailToDesktop: () => void;
|
|
58
|
-
toggleBlocksAndStructuresVisibility: () => void;
|
|
59
|
-
updateCustomBlockContent: (content: string) => void;
|
|
60
|
-
refreshComments: (key: string) => void;
|
|
61
|
-
refreshSyncedRows: () => void;
|
|
62
|
-
openPremadeTemplatesSelection: () => void;
|
|
63
|
-
updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
|
|
64
|
-
setTemplateName: (name: string) => void;
|
|
65
|
-
updateOptions: (options: Partial<ITopolOptions>) => void;
|
|
66
|
-
toggleChatAI: () => void;
|
|
67
|
-
toggleAutosaves: () => void;
|
|
68
|
-
toggleComments: () => void;
|
|
69
|
-
createLanguage: (lang: string) => void;
|
|
70
|
-
setPrimaryLanguage: (lang: string) => void;
|
|
71
|
-
deleteLanguage: (lang: string) => void;
|
|
72
|
-
selectLanguage: (lang: string) => void;
|
|
73
|
-
getMutations: () => void;
|
|
74
|
-
toggleControlPanel: () => void;
|
|
75
|
-
updateTemplate: (json: unknown, options?: {
|
|
76
|
-
skipSnapshot?: boolean | undefined;
|
|
77
|
-
} | undefined) => void;
|
|
78
|
-
toggleDarkMode: () => void;
|
|
79
|
-
};
|
|
80
|
-
import { LandingPageEditor } from "./landing-page-editor";
|
|
81
|
-
import type ITopolOptions from "../types/ITopolOptions";
|
|
82
|
-
import type IEmailCallbacks from "../types/Callbacks/IEmailCallbacks";
|
|
83
|
-
import type INotification from "../types/Notification/INotification";
|
|
84
|
-
import type ISavedBlock from "../types/SavedBlock/ISavedBlock";
|
|
85
|
-
import type IMergeTagGroup from "../types/MergeTag/IMergeTagGroup";
|
|
86
|
-
import type IMergeTag from "../types/MergeTag/IMergeTag";
|
|
87
|
-
import type { IContentBlockOptions } from "../types/ContentBlock/IContentBlockOptions";
|
|
88
|
-
import type ITheme from "../types/Theme/ITheme";
|
|
89
|
-
import type IAuthHeaderConfig from "../types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
90
|
-
import type IFont from "../types/Font/IFont";
|
|
91
|
-
import type IAPI from "../types/API/API";
|
|
92
|
-
import type ICustomBlockData from "../types/CustomBlocks/CustomBlocks";
|
|
93
|
-
import { Stage } from "../types/Stage";
|
|
94
|
-
import type { ISaveData, IErrorData, ISendTestData } from "../types/Callbacks/ICallbackPayloads";
|
|
95
|
-
import type ILandingPageOptions from "../types/landing-page/ILandingPageOptions";
|
|
96
|
-
import type { ILandingPageCallbacks, ILandingPageSavePayload, ILandingPageDeletedItem, ILandingPageErrorPayload } from "../types/landing-page/ILandingPageOptions";
|
|
97
|
-
import type ILandingPageEditorInstance from "../types/landing-page/ILandingPageEditorInstance";
|
|
98
|
-
import type { TopolSection } from "./landing-page-editor/schemas/template/structure/sectionSchema";
|
|
99
|
-
export default TopolPlugin;
|
|
100
|
-
/**
|
|
101
|
-
* @deprecated Use `EmailEditor` instead. `TopolPlugin` is an alias for backwards compatibility.
|
|
102
|
-
*/
|
|
103
|
-
export { TopolPlugin };
|
|
104
|
-
export { EmailEditor };
|
|
105
|
-
export { LandingPageEditor };
|
|
106
|
-
export type { ITopolOptions, IEmailCallbacks, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
|
|
107
|
-
export type { ISaveData, IErrorData, ISendTestData };
|
|
108
|
-
export type { ILandingPageOptions, ILandingPageCallbacks, ILandingPageEditorInstance, TopolSection, ILandingPageSavePayload, ILandingPageDeletedItem, ILandingPageErrorPayload };
|
|
1
|
+
export { EmailEditor } from "./email-editor";
|
|
2
|
+
export { LandingPageEditor } from "./landing-page-editor";
|
|
3
|
+
export type { default as IEmailOptions } from "../types/IEmailOptions";
|
|
4
|
+
export type { default as IEmailConfig } from "../types/IEmailConfig";
|
|
5
|
+
export type { default as IEmailCallbacks } from "../types/Callbacks/IEmailCallbacks";
|
|
6
|
+
export type { default as IEmailEditorInstance, IUpdateTemplateOptions } from "../types/IEmailEditorInstance";
|
|
7
|
+
export type { IEmailEditorPluginOptions } from "./email-editor";
|
|
8
|
+
export type { IEmailSavePayload, IEmailErrorPayload, IEmailTestSendPayload, IEmailDeletedItem, ILanguageMutation, ILanguageChangePayload } from "../types/Callbacks/ICallbackPayloads";
|
|
9
|
+
export type { default as ILandingPageOptions, ILandingPageConfig, ILandingPageCallbacks, ILandingPageSavePayload, ILandingPageErrorPayload, ILandingPageDeletedItem } from "../types/landing-page/ILandingPageOptions";
|
|
10
|
+
export type { default as ILandingPageEditorInstance } from "../types/landing-page/ILandingPageEditorInstance";
|
|
11
|
+
export type { ILandingPageEditorPluginOptions } from "./landing-page-editor";
|
|
12
|
+
export type { Stage as IStage } from "../types/Stage";
|
|
13
|
+
export type { EditorErrorSource } from "../types/Callbacks/ICallbackPayloads";
|
|
14
|
+
export type { INonceAuthCallbacks } from "../types/Auth/INonceAuthCallbacks";
|
|
15
|
+
export type { IAuthorize } from "../types/Auth/IAuthorize";
|
|
16
|
+
export type { EmailEditorShortcut, LandingPageEditorShortcut } from "../types/Shortcuts/EditorShortcut";
|
|
17
|
+
export type { default as INotification } from "../types/Notification/INotification";
|
|
18
|
+
export type { default as IMergeTagGroup } from "../types/MergeTag/IMergeTagGroup";
|
|
19
|
+
export type { default as IMergeTag, IMergeTagChildProperty, IMergeTagSuggestionSet } from "../types/MergeTag/IMergeTag";
|
|
20
|
+
export type { IContentBlockOptions } from "../types/ContentBlock/IContentBlockOptions";
|
|
21
|
+
export type { ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag } from "../types/Countdown/ICountdownOptions";
|
|
22
|
+
export type { default as ITheme } from "../types/Theme/ITheme";
|
|
23
|
+
export type { default as IAuthHeaderConfig } from "../types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
24
|
+
export type { default as IFont } from "../types/Font/IFont";
|
|
25
|
+
export type { default as IAPI } from "../types/API/API";
|
|
26
|
+
export type { default as ICustomBlockData } from "../types/CustomBlocks/CustomBlocks";
|
|
27
|
+
export type { ICloudFeatures, ICloudOptions, ICloudCallbacks, ICloudSavePayload, ICloudTemplateChangePayload } from "../types/Cloud/ICloudOptions";
|
|
28
|
+
export type { ISavedSection, ISavedSectionDraft, IPremadeSection, IPremadeSections, ILegacyPremadeSections, IPremadeSectionsOptions, IPremadePreset, IPremadePresetId } from "../types/Sections/ISections";
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
export default interface IAPI {
|
|
2
|
-
AUTOSAVE?: string;
|
|
3
2
|
AUTOSAVES?: string;
|
|
4
|
-
GET_AUTOSAVE?: string;
|
|
5
3
|
CONVERSATIONS?: string;
|
|
6
4
|
COMMENTS?: string;
|
|
7
5
|
IMAGE_UPLOAD?: string;
|
|
8
|
-
IMAGE_EDITOR_UPLOAD?: string;
|
|
9
6
|
FOLDERS?: string;
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
GENERATE_TEXT?: string;
|
|
8
|
+
GENERATE_PREHEADER?: string;
|
|
9
|
+
GENERATE_TRANSLATION?: string;
|
|
12
10
|
PRODUCTS?: string;
|
|
13
11
|
FEEDS?: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
PRODUCT_CATEGORIES?: string;
|
|
13
|
+
SAVED_SECTIONS?: string;
|
|
14
|
+
PREMADE_TEMPLATES?: string;
|
|
15
|
+
PREMADE_TEMPLATE_CATEGORIES?: string;
|
|
16
|
+
PREMADE_TEMPLATE_KEYWORDS?: string;
|
|
18
17
|
}
|
|
@@ -1,12 +1,21 @@
|
|
|
1
|
+
interface IAPIBlockMergeTag {
|
|
2
|
+
label: string;
|
|
3
|
+
value: string;
|
|
4
|
+
}
|
|
1
5
|
export default interface IAPIBlockProperties {
|
|
6
|
+
name: string;
|
|
2
7
|
pluralName: string;
|
|
3
8
|
icon: string;
|
|
4
9
|
blockStructure: any;
|
|
5
10
|
apiStructure?: any;
|
|
6
11
|
itemsURL?: string;
|
|
7
12
|
feedsURL?: string;
|
|
13
|
+
categoriesURL?: string;
|
|
8
14
|
apiWithoutSearch?: boolean;
|
|
9
15
|
nextKey?: boolean;
|
|
10
16
|
beta?: boolean;
|
|
11
17
|
disabled?: boolean;
|
|
18
|
+
/** Merge tags offered for the items of this block. */
|
|
19
|
+
dynamicMergeTags?: IAPIBlockMergeTag[];
|
|
12
20
|
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nonce authentication. Passing `getNonce` switches the editor from the legacy
|
|
3
|
+
* public-key authorize call to short-lived `nc_` nonces minted on your backend.
|
|
4
|
+
* Shared by the Email and Landing Page Editors. Works on its own (every feature stays
|
|
5
|
+
* external); the Email Editor's Topol Cloud requires it.
|
|
6
|
+
*/
|
|
7
|
+
export interface INonceAuthCallbacks {
|
|
8
|
+
/** Fetch a fresh nc_ nonce from your authenticated backend. Never expose an sk_ secret in the browser. */
|
|
9
|
+
getNonce?(): Promise<string>;
|
|
10
|
+
}
|
|
@@ -1,35 +1,39 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
* Used when transforming (json, html) arguments into a single object.
|
|
8
|
-
*/
|
|
9
|
-
export interface ISaveData {
|
|
1
|
+
/** Language identifiers use code in editor v4. */
|
|
2
|
+
export interface ILanguageMutation {
|
|
3
|
+
code: string;
|
|
4
|
+
primary: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface IEmailSavePayload {
|
|
10
7
|
json: unknown;
|
|
11
8
|
html: unknown;
|
|
12
|
-
mutations?:
|
|
13
|
-
key: string;
|
|
14
|
-
primary: boolean;
|
|
15
|
-
}[];
|
|
9
|
+
mutations?: ILanguageMutation[];
|
|
16
10
|
syncedSections?: number[];
|
|
17
11
|
}
|
|
18
12
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
13
|
+
* Where an `onEditorError` came from, shared by the Email and Landing Page Editors.
|
|
14
|
+
* `integration`: the wrapper or loader could not start the editor (the iframe never booted).
|
|
15
|
+
* `init`: the editor itself crashed while starting up.
|
|
16
|
+
* Renaming or removing a value is a breaking change.
|
|
21
17
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
18
|
+
export type EditorErrorSource = "integration" | "init" | "authorize" | "nonceAuth" | "network" | "load" | "updateTemplate" | "save" | "testSend" | "cloudTemplates" | "cloudSync";
|
|
19
|
+
export interface IEmailErrorPayload {
|
|
20
|
+
source: EditorErrorSource;
|
|
24
21
|
message: string;
|
|
25
|
-
|
|
22
|
+
detail?: unknown;
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
* Payload for onTestSend callback (Email Editor only).
|
|
29
|
-
* Used when transforming (email, json, html) arguments into a single object.
|
|
30
|
-
*/
|
|
31
|
-
export interface ISendTestData {
|
|
24
|
+
export interface IEmailTestSendPayload {
|
|
32
25
|
email: string | string[];
|
|
33
26
|
json: unknown;
|
|
34
27
|
html: unknown;
|
|
35
28
|
}
|
|
29
|
+
export interface ILanguageChangePayload {
|
|
30
|
+
code: string;
|
|
31
|
+
mutations: ILanguageMutation[];
|
|
32
|
+
}
|
|
33
|
+
export interface IEmailDeletedItem {
|
|
34
|
+
name: string;
|
|
35
|
+
type: "file" | "folder";
|
|
36
|
+
path: string;
|
|
37
|
+
url?: string;
|
|
38
|
+
key: string | null;
|
|
39
|
+
}
|
|
@@ -1,160 +1,78 @@
|
|
|
1
|
-
import type ISavedBlock from "../SavedBlock/ISavedBlock";
|
|
2
1
|
import type INotification from "../Notification/INotification";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
primary: boolean;
|
|
17
|
-
}[], syncedSections: number[]): void;
|
|
18
|
-
/**
|
|
19
|
-
* Called when the user clicks "Save and Close".
|
|
20
|
-
* @param json - The email template JSON structure
|
|
21
|
-
* @param html - The generated HTML output
|
|
22
|
-
* @param mutations - The mutations applied to the email template
|
|
23
|
-
* @param syncedSections - The synced sections id that were in the email template at the time of saving
|
|
24
|
-
*/
|
|
25
|
-
onSaveAndClose?(json: unknown, html: unknown, mutations: {
|
|
26
|
-
key: string;
|
|
27
|
-
primary: boolean;
|
|
28
|
-
}[], syncedSections: number[]): void;
|
|
29
|
-
/**
|
|
30
|
-
* Called when the user sends a test email.
|
|
31
|
-
* @param email - The email address(es) to send to
|
|
32
|
-
* @param json - The email template JSON structure
|
|
33
|
-
* @param html - The generated HTML output
|
|
34
|
-
*/
|
|
35
|
-
onTestSend?(email: string | string[], json: unknown, html: unknown): void;
|
|
36
|
-
/**
|
|
37
|
-
* Called when the user clicks the banner (free version only).
|
|
38
|
-
* @param json - The email template JSON structure
|
|
39
|
-
* @param html - The generated HTML output
|
|
40
|
-
*/
|
|
41
|
-
onBannerClick?(json: unknown, html: unknown): void;
|
|
42
|
-
/**
|
|
43
|
-
* Called when the custom file manager should be opened.
|
|
44
|
-
*/
|
|
2
|
+
import type { ISavedSectionDraft } from "../Sections/ISections";
|
|
3
|
+
import type { ICloudCallbacks } from "../Cloud/ICloudOptions";
|
|
4
|
+
import type { INonceAuthCallbacks } from "../Auth/INonceAuthCallbacks";
|
|
5
|
+
import type { IEmailSavePayload, IEmailTestSendPayload, IEmailErrorPayload, ILanguageChangePayload, ILanguageMutation, IEmailDeletedItem } from "./ICallbackPayloads";
|
|
6
|
+
/** v4 host callbacks. Return save promises so the editor can await persistence. */
|
|
7
|
+
export default interface IEmailCallbacks extends INonceAuthCallbacks, ICloudCallbacks {
|
|
8
|
+
onSave?(payload: IEmailSavePayload): void | Promise<void>;
|
|
9
|
+
onSaveAndClose?(payload: IEmailSavePayload): void | Promise<void>;
|
|
10
|
+
onTestSend?(payload: IEmailTestSendPayload): void;
|
|
11
|
+
onBannerClick?(payload: {
|
|
12
|
+
json: unknown;
|
|
13
|
+
html: unknown;
|
|
14
|
+
}): void;
|
|
45
15
|
onOpenFileManager?(): void;
|
|
46
|
-
/**
|
|
47
|
-
* Called when the editor has finished loading.
|
|
48
|
-
*/
|
|
49
16
|
onLoaded?(): void;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
* @param blockId - The ID of the block being edited
|
|
63
|
-
*/
|
|
64
|
-
onBlockEdit?(blockId: number): void;
|
|
65
|
-
/**
|
|
66
|
-
* Called when the editor is initialized.
|
|
67
|
-
*/
|
|
17
|
+
onSavedSectionSave?(payload: {
|
|
18
|
+
section: ISavedSectionDraft;
|
|
19
|
+
}): void;
|
|
20
|
+
onSavedSectionRemove?(payload: {
|
|
21
|
+
id: number;
|
|
22
|
+
}): void;
|
|
23
|
+
onSavedSectionEdit?(payload: {
|
|
24
|
+
id: number;
|
|
25
|
+
}): void;
|
|
26
|
+
onImageDelete?(payload: {
|
|
27
|
+
items: IEmailDeletedItem[];
|
|
28
|
+
}): void;
|
|
68
29
|
onInit?(): void;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
*
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
* @param responseBody - The response body (optional)
|
|
118
|
-
*/
|
|
119
|
-
onError?(type: string, message: string, responseBody?: unknown): void;
|
|
120
|
-
/**
|
|
121
|
-
* Called when a new language variant is created.
|
|
122
|
-
* @param lang - The language code that was created
|
|
123
|
-
* @param mutations - The mutations applied to the email template at the time of language creation
|
|
124
|
-
*/
|
|
125
|
-
onLanguageCreated?(lang: string, mutations: {
|
|
126
|
-
key: string;
|
|
127
|
-
primary: boolean;
|
|
128
|
-
}[]): void;
|
|
129
|
-
/**
|
|
130
|
-
* Called when a language variant is deleted.
|
|
131
|
-
* @param lang - The language code that was deleted
|
|
132
|
-
* @param mutations - The mutations applied to the email template at the time of language deletion
|
|
133
|
-
*/
|
|
134
|
-
onLanguageDeleted?(lang: string, mutations: {
|
|
135
|
-
key: string;
|
|
136
|
-
primary: boolean;
|
|
137
|
-
}[]): void;
|
|
138
|
-
/**
|
|
139
|
-
* Called when a language variant is selected/switched to.
|
|
140
|
-
* @param lang - The language code that was selected
|
|
141
|
-
*/
|
|
142
|
-
onLanguageSelected?(lang: string): void;
|
|
143
|
-
/**
|
|
144
|
-
* Called when the primary language is changed.
|
|
145
|
-
* @param lang - The language code that was set as primary
|
|
146
|
-
* @param mutations - The mutations applied to the email template at the time of primary language change
|
|
147
|
-
*/
|
|
148
|
-
onPrimaryLanguageChanged?(lang: string, mutations: {
|
|
149
|
-
key: string;
|
|
150
|
-
primary: boolean;
|
|
151
|
-
}[]): void;
|
|
152
|
-
/**
|
|
153
|
-
* Called when mutations are requested via `getMutations`.
|
|
154
|
-
* @param mutations - The mutations currently applied to the email template
|
|
155
|
-
*/
|
|
156
|
-
onGetMutations?(mutations: {
|
|
157
|
-
key: string;
|
|
158
|
-
primary: boolean;
|
|
159
|
-
}[]): void;
|
|
30
|
+
onUndoChange?(payload: {
|
|
31
|
+
count: number;
|
|
32
|
+
}): void;
|
|
33
|
+
onRedoChange?(payload: {
|
|
34
|
+
count: number;
|
|
35
|
+
}): void;
|
|
36
|
+
onPreview?(payload: {
|
|
37
|
+
html: unknown;
|
|
38
|
+
}): void;
|
|
39
|
+
onPreviewClose?(): void;
|
|
40
|
+
onAlert?(payload: {
|
|
41
|
+
notification: INotification;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* Called when the user closes the editor from the window bar. Closing the editor UI is your
|
|
45
|
+
* job in this handler. May return a Promise: the editor waits for it, and closes itself if
|
|
46
|
+
* it rejects.
|
|
47
|
+
*/
|
|
48
|
+
onEditorClose?(): void | Promise<void>;
|
|
49
|
+
/** Called when the unsaved-changes state flips; `hasUnsavedChanges` is `true` while there are unsaved edits. */
|
|
50
|
+
onUnsavedChangesChange?(payload: {
|
|
51
|
+
hasUnsavedChanges: boolean;
|
|
52
|
+
}): void;
|
|
53
|
+
/** Called when hidden elements are shown or hidden: by the top-bar switch, `toggleHiddenElementsVisibility()` or the reveal on device switch. */
|
|
54
|
+
onHiddenElementsVisibilityChange?(payload: {
|
|
55
|
+
visible: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
onOpenCustomBlockDialog?(payload: {
|
|
58
|
+
block: unknown;
|
|
59
|
+
}): void;
|
|
60
|
+
onTemplateRename?(payload: {
|
|
61
|
+
name: string;
|
|
62
|
+
}): void;
|
|
63
|
+
onTemplateUpdated?(): void;
|
|
64
|
+
/** Called when the user edits the list of test email addresses. */
|
|
65
|
+
onTestingEmailsChange?(payload: {
|
|
66
|
+
emails: string[];
|
|
67
|
+
}): void;
|
|
68
|
+
onEditorError?(payload: IEmailErrorPayload): void;
|
|
69
|
+
onLanguageCreated?(payload: ILanguageChangePayload): void;
|
|
70
|
+
onLanguageDeleted?(payload: ILanguageChangePayload): void;
|
|
71
|
+
onLanguageSelected?(payload: {
|
|
72
|
+
code: string;
|
|
73
|
+
}): void;
|
|
74
|
+
onPrimaryLanguageChanged?(payload: ILanguageChangePayload): void;
|
|
75
|
+
onGetMutations?(payload: {
|
|
76
|
+
mutations: ILanguageMutation[];
|
|
77
|
+
}): void;
|
|
160
78
|
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Enabling Cloud opts in to all features; set individual features to false to use your own backend. */
|
|
2
|
+
export interface ICloudFeatures {
|
|
3
|
+
templates?: boolean;
|
|
4
|
+
autosaves?: boolean;
|
|
5
|
+
images?: boolean;
|
|
6
|
+
comments?: boolean;
|
|
7
|
+
sections?: boolean;
|
|
8
|
+
multilanguage?: boolean;
|
|
9
|
+
testSend?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ICloudOptions {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
/** Cloud template to open. Top-level config.templateId is ignored in Cloud mode. */
|
|
14
|
+
templateId?: number | string;
|
|
15
|
+
features?: ICloudFeatures;
|
|
16
|
+
}
|
|
17
|
+
export interface ICloudSavePayload {
|
|
18
|
+
templateId: number | string;
|
|
19
|
+
name?: string;
|
|
20
|
+
langCode?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ICloudTemplateChangePayload {
|
|
23
|
+
type: "rename" | "delete" | "duplicate" | "move";
|
|
24
|
+
templateId: number | string;
|
|
25
|
+
name?: string;
|
|
26
|
+
folderId?: number | null;
|
|
27
|
+
}
|
|
28
|
+
/** Cloud-scoped callbacks. Cloud also requires `getNonce` from INonceAuthCallbacks. */
|
|
29
|
+
export interface ICloudCallbacks {
|
|
30
|
+
onCloudSave?(payload: ICloudSavePayload): void;
|
|
31
|
+
onCloudTemplateChange?(payload: ICloudTemplateChangePayload): void;
|
|
32
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type BlockType = "text" | "image" | "gif" | "button" | "divider" | "spacer" | "social" | "video" | "html" | "product" | "dynamic" | "article" | "carousel" | "
|
|
1
|
+
type BlockType = "text" | "image" | "gif" | "button" | "divider" | "spacer" | "social" | "video" | "html" | "product" | "dynamic" | "article" | "carousel" | "countdown" | "loop" | "rating";
|
|
2
2
|
export type IContentBlockOption = {
|
|
3
3
|
disabled?: boolean;
|
|
4
4
|
disabledText?: string;
|