@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.
- package/README.md +153 -101
- package/dist/topol-plugin.es.js +146 -191
- package/dist/topol-plugin.umd.cjs +1 -0
- package/dist/types/src/core/script-loader.d.ts +15 -0
- package/dist/types/src/email-editor/constants.d.ts +3 -3
- package/dist/types/src/email-editor/index.d.ts +16 -91
- package/dist/types/src/landing-page-editor/constants.d.ts +1 -1
- package/dist/types/src/landing-page-editor/index.d.ts +27 -10
- 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 +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 +153 -17
- 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 +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 +28 -101
- package/dist/types/types/API/API.d.ts +10 -9
- 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 +10 -0
- package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +28 -18
- package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +85 -104
- 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/IEmailConfig.d.ts +225 -0
- package/dist/types/types/IEmailEditorInstance.d.ts +68 -0
- package/dist/types/types/IEmailOptions.d.ts +7 -0
- package/dist/types/types/Language/Language.d.ts +6 -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 +73 -9
- package/dist/types/types/landing-page/ILandingPageOptions.d.ts +110 -62
- package/package.json +10 -13
- 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/ITopolOptions.d.ts +0 -123
- package/dist/types/types/ITopolPlugin.d.ts +0 -37
- 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,101 +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: () => 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
|
-
toggleChatAI: () => void;
|
|
66
|
-
toggleAutosaves: () => void;
|
|
67
|
-
toggleComments: () => void;
|
|
68
|
-
createLanguage: (lang: string) => void;
|
|
69
|
-
setPrimaryLanguage: (lang: string) => void;
|
|
70
|
-
deleteLanguage: (lang: string) => void;
|
|
71
|
-
selectLanguage: (lang: string) => void;
|
|
72
|
-
};
|
|
73
|
-
import { LandingPageEditor } from "./landing-page-editor";
|
|
74
|
-
import type ITopolOptions from "../types/ITopolOptions";
|
|
75
|
-
import type IEmailCallbacks from "../types/Callbacks/IEmailCallbacks";
|
|
76
|
-
import type INotification from "../types/Notification/INotification";
|
|
77
|
-
import type ISavedBlock from "../types/SavedBlock/ISavedBlock";
|
|
78
|
-
import type IMergeTagGroup from "../types/MergeTag/IMergeTagGroup";
|
|
79
|
-
import type IMergeTag from "../types/MergeTag/IMergeTag";
|
|
80
|
-
import type { IContentBlockOptions } from "../types/ContentBlock/IContentBlockOptions";
|
|
81
|
-
import type ITheme from "../types/Theme/ITheme";
|
|
82
|
-
import type IAuthHeaderConfig from "../types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
83
|
-
import type IFont from "../types/Font/IFont";
|
|
84
|
-
import type IAPI from "../types/API/API";
|
|
85
|
-
import type ICustomBlockData from "../types/CustomBlocks/CustomBlocks";
|
|
86
|
-
import { Stage } from "../types/Stage";
|
|
87
|
-
import type { ISaveData, IErrorData, ISendTestData } from "../types/Callbacks/ICallbackPayloads";
|
|
88
|
-
import type ILandingPageOptions from "../types/landing-page/ILandingPageOptions";
|
|
89
|
-
import type { ILandingPageCallbacks } from "../types/landing-page/ILandingPageOptions";
|
|
90
|
-
import type ILandingPageEditorInstance from "../types/landing-page/ILandingPageEditorInstance";
|
|
91
|
-
import type { TopolSection } from "./landing-page-editor/schemas/template/structure/sectionSchema";
|
|
92
|
-
export default TopolPlugin;
|
|
93
|
-
/**
|
|
94
|
-
* @deprecated Use `EmailEditor` instead. `TopolPlugin` is an alias for backwards compatibility.
|
|
95
|
-
*/
|
|
96
|
-
export { TopolPlugin };
|
|
97
|
-
export { EmailEditor };
|
|
98
|
-
export { LandingPageEditor };
|
|
99
|
-
export type { ITopolOptions, IEmailCallbacks, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
|
|
100
|
-
export type { ISaveData, IErrorData, ISendTestData };
|
|
101
|
-
export type { ILandingPageOptions, ILandingPageCallbacks, ILandingPageEditorInstance, TopolSection };
|
|
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,19 @@
|
|
|
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;
|
|
17
|
+
/** @deprecated Use `PREMADE_TEMPLATE_KEYWORDS`. */
|
|
18
|
+
PREMADE_TEMPLATES_KEYWORDS?: string;
|
|
18
19
|
}
|
|
@@ -1,12 +1,23 @@
|
|
|
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[];
|
|
20
|
+
/** @deprecated Use `dynamicMergeTags`. */
|
|
21
|
+
dynamicMergetags?: IAPIBlockMergeTag[];
|
|
12
22
|
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
type EntityId = string | number;
|
|
2
|
+
/**
|
|
3
|
+
* `entityId` names the account the editor works for. The deprecated `userId` is the same value
|
|
4
|
+
* under its old name; when both are set and differ, `entityId` wins.
|
|
5
|
+
*/
|
|
6
|
+
export type IAuthorize = {
|
|
7
|
+
apiKey: string;
|
|
8
|
+
} & ({
|
|
9
|
+
/** URL-safe [A-Za-z0-9_-]+ string or a non-negative integer. */
|
|
10
|
+
entityId: EntityId;
|
|
11
|
+
/** @deprecated Use `entityId`. Accepted until the next major. */
|
|
12
|
+
userId?: EntityId;
|
|
13
|
+
} | {
|
|
14
|
+
entityId?: undefined;
|
|
15
|
+
/** @deprecated Use `entityId`. Accepted until the next major. */
|
|
16
|
+
userId: EntityId;
|
|
17
|
+
});
|
|
18
|
+
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,29 +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;
|
|
9
|
+
mutations?: ILanguageMutation[];
|
|
10
|
+
syncedSections?: number[];
|
|
12
11
|
}
|
|
13
12
|
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
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.
|
|
16
17
|
*/
|
|
17
|
-
export
|
|
18
|
-
|
|
18
|
+
export type EditorErrorSource = "integration" | "init" | "authorize" | "nonceAuth" | "network" | "load" | "updateTemplate" | "save" | "testSend" | "cloudTemplates" | "cloudSync";
|
|
19
|
+
export interface IEmailErrorPayload {
|
|
20
|
+
source: EditorErrorSource;
|
|
19
21
|
message: string;
|
|
22
|
+
detail?: unknown;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
* Payload for onTestSend callback (Email Editor only).
|
|
23
|
-
* Used when transforming (email, json, html) arguments into a single object.
|
|
24
|
-
*/
|
|
25
|
-
export interface ISendTestData {
|
|
24
|
+
export interface IEmailTestSendPayload {
|
|
26
25
|
email: string | string[];
|
|
27
26
|
json: unknown;
|
|
28
27
|
html: unknown;
|
|
29
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,109 +1,90 @@
|
|
|
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
|
-
* @param html - The generated HTML output
|
|
17
|
-
*/
|
|
18
|
-
onSaveAndClose?(json: unknown, html: unknown): void;
|
|
19
|
-
/**
|
|
20
|
-
* Called when the user sends a test email.
|
|
21
|
-
* @param email - The email address(es) to send to
|
|
22
|
-
* @param json - The email template JSON structure
|
|
23
|
-
* @param html - The generated HTML output
|
|
24
|
-
*/
|
|
25
|
-
onTestSend?(email: string | string[], json: unknown, html: unknown): void;
|
|
26
|
-
/**
|
|
27
|
-
* Called when the user clicks the banner (free version only).
|
|
28
|
-
* @param json - The email template JSON structure
|
|
29
|
-
* @param html - The generated HTML output
|
|
30
|
-
*/
|
|
31
|
-
onBannerClick?(json: unknown, html: unknown): void;
|
|
32
|
-
/**
|
|
33
|
-
* Called when the custom file manager should be opened.
|
|
34
|
-
*/
|
|
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;
|
|
35
15
|
onOpenFileManager?(): void;
|
|
36
|
-
/**
|
|
37
|
-
* Called when the editor has finished loading.
|
|
38
|
-
*/
|
|
39
16
|
onLoaded?(): void;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
* @param blockId - The ID of the block being edited
|
|
53
|
-
*/
|
|
54
|
-
onBlockEdit?(blockId: number): void;
|
|
55
|
-
/**
|
|
56
|
-
* Called when the editor is initialized.
|
|
57
|
-
*/
|
|
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;
|
|
58
29
|
onInit?(): void;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
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
|
-
onTemplateRename?(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
+
/** @deprecated Use `onUnsavedChangesChange`. Fires alongside it; the editor logs a deprecation warning when it is passed. */
|
|
54
|
+
onEdittedWithoutSaveChanged?(payload: {
|
|
55
|
+
value: boolean;
|
|
56
|
+
}): void;
|
|
57
|
+
/** Called when hidden elements are shown or hidden: by the top-bar switch, `toggleHiddenElementsVisibility()` or the reveal on device switch. */
|
|
58
|
+
onHiddenElementsVisibilityChange?(payload: {
|
|
59
|
+
visible: boolean;
|
|
60
|
+
}): void;
|
|
61
|
+
/** @deprecated Use `onHiddenElementsVisibilityChange`. Fires only on the reveal on device switch, always with `value: false`; the editor logs a deprecation warning when it is passed. */
|
|
62
|
+
onBlocksAndStructuresVisibilityChange?(payload: {
|
|
63
|
+
value: boolean;
|
|
64
|
+
}): void;
|
|
65
|
+
onOpenCustomBlockDialog?(payload: {
|
|
66
|
+
block: unknown;
|
|
67
|
+
}): void;
|
|
68
|
+
onTemplateRename?(payload: {
|
|
69
|
+
name: string;
|
|
70
|
+
}): void;
|
|
71
|
+
onTemplateUpdated?(): void;
|
|
72
|
+
/** Called when the user edits the list of test email addresses. */
|
|
73
|
+
onTestingEmailsChange?(payload: {
|
|
74
|
+
emails: string[];
|
|
75
|
+
}): void;
|
|
76
|
+
/** @deprecated Use `onTestingEmailsChange`. Fires right after it; the editor logs a deprecation warning when it is passed. */
|
|
77
|
+
updateTestingEmailAddresses?(payload: {
|
|
78
|
+
emails: string[];
|
|
79
|
+
}): void;
|
|
80
|
+
onEditorError?(payload: IEmailErrorPayload): void;
|
|
81
|
+
onLanguageCreated?(payload: ILanguageChangePayload): void;
|
|
82
|
+
onLanguageDeleted?(payload: ILanguageChangePayload): void;
|
|
83
|
+
onLanguageSelected?(payload: {
|
|
84
|
+
code: string;
|
|
85
|
+
}): void;
|
|
86
|
+
onPrimaryLanguageChanged?(payload: ILanguageChangePayload): void;
|
|
87
|
+
onGetMutations?(payload: {
|
|
88
|
+
mutations: ILanguageMutation[];
|
|
89
|
+
}): void;
|
|
109
90
|
}
|
|
@@ -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;
|
|
@@ -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
|
+
}
|