@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
|
@@ -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,47 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* TopolPlugin is the original name for the Email Editor integration.
|
|
6
|
-
* New code should use `EmailEditor` for clarity.
|
|
7
|
-
*/
|
|
8
|
-
declare const TopolPlugin: {
|
|
9
|
-
init(options: ITopolOptions, pluginOptions?: import("./email-editor").IEmailEditorPluginOptions | undefined): Promise<import("../types/IEmailEditorInstance").default>;
|
|
10
|
-
};
|
|
11
|
-
import { LandingPageEditor } from "./landing-page-editor";
|
|
12
|
-
import type ITopolOptions from "../types/ITopolOptions";
|
|
13
|
-
import type IEmailCallbacks from "../types/Callbacks/IEmailCallbacks";
|
|
14
|
-
import type INotification from "../types/Notification/INotification";
|
|
15
|
-
import type ISavedBlock from "../types/SavedBlock/ISavedBlock";
|
|
16
|
-
import type IMergeTagGroup from "../types/MergeTag/IMergeTagGroup";
|
|
17
|
-
import type IMergeTag from "../types/MergeTag/IMergeTag";
|
|
18
|
-
import type { IContentBlockOptions } from "../types/ContentBlock/IContentBlockOptions";
|
|
19
|
-
import type { ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag } from "../types/Countdown/ICountdownOptions";
|
|
20
|
-
import type ITheme from "../types/Theme/ITheme";
|
|
21
|
-
import type IAuthHeaderConfig from "../types/AuthHeaderConfig/IAuthHeaderConfig";
|
|
22
|
-
import type IFont from "../types/Font/IFont";
|
|
23
|
-
import type IAPI from "../types/API/API";
|
|
24
|
-
import type ICustomBlockData from "../types/CustomBlocks/CustomBlocks";
|
|
25
|
-
import { Stage } from "../types/Stage";
|
|
26
|
-
import type { ISaveData, IErrorData, ISendTestData } from "../types/Callbacks/ICallbackPayloads";
|
|
27
|
-
import type ILandingPageOptions from "../types/landing-page/ILandingPageOptions";
|
|
28
|
-
import type { ILandingPageCallbacks, ILandingPageSavePayload, ILandingPageDeletedItem, ILandingPageErrorPayload } from "../types/landing-page/ILandingPageOptions";
|
|
29
|
-
import type ILandingPageEditorInstance from "../types/landing-page/ILandingPageEditorInstance";
|
|
30
|
-
import type { TopolSection } from "./landing-page-editor/schemas/template/structure/sectionSchema";
|
|
31
|
-
export default TopolPlugin;
|
|
32
|
-
/**
|
|
33
|
-
* @deprecated Use `EmailEditor` instead. `TopolPlugin` is an alias as a naming alias.
|
|
34
|
-
*/
|
|
35
|
-
export { TopolPlugin };
|
|
36
|
-
export { EmailEditor };
|
|
37
|
-
export { LandingPageEditor };
|
|
38
|
-
export type { ITopolOptions, IEmailCallbacks, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage, };
|
|
39
|
-
export type { ISaveData, IErrorData, ISendTestData };
|
|
40
|
-
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";
|
|
41
4
|
export type { default as IEmailConfig } from "../types/IEmailConfig";
|
|
5
|
+
export type { default as IEmailCallbacks } from "../types/Callbacks/IEmailCallbacks";
|
|
42
6
|
export type { default as IEmailEditorInstance, IUpdateTemplateOptions } from "../types/IEmailEditorInstance";
|
|
43
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";
|
|
44
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";
|
|
45
27
|
export type { ICloudFeatures, ICloudOptions, ICloudCallbacks, ICloudSavePayload, ICloudTemplateChangePayload } from "../types/Cloud/ICloudOptions";
|
|
46
|
-
export type { ISavedSection, IPremadeSection, IPremadeSections, ILegacyPremadeSections, IPremadeSectionsOptions } from "../types/Sections/ISections";
|
|
47
|
-
export type { ILanguageMutation, ILanguageChangePayload, IEmailDeletedItem } from "../types/Callbacks/ICallbackPayloads";
|
|
28
|
+
export type { ISavedSection, ISavedSectionDraft, IPremadeSection, IPremadeSections, ILegacyPremadeSections, IPremadeSectionsOptions, IPremadePreset, IPremadePresetId } from "../types/Sections/ISections";
|
|
@@ -3,7 +3,6 @@ export default interface IAPI {
|
|
|
3
3
|
CONVERSATIONS?: string;
|
|
4
4
|
COMMENTS?: string;
|
|
5
5
|
IMAGE_UPLOAD?: string;
|
|
6
|
-
IMAGE_EDITOR_UPLOAD?: string;
|
|
7
6
|
FOLDERS?: string;
|
|
8
7
|
GENERATE_TEXT?: string;
|
|
9
8
|
GENERATE_PREHEADER?: string;
|
|
@@ -12,8 +11,9 @@ export default interface IAPI {
|
|
|
12
11
|
FEEDS?: string;
|
|
13
12
|
PRODUCT_CATEGORIES?: string;
|
|
14
13
|
SAVED_SECTIONS?: string;
|
|
15
|
-
TEST_EMAIL?: string;
|
|
16
14
|
PREMADE_TEMPLATES?: string;
|
|
17
15
|
PREMADE_TEMPLATE_CATEGORIES?: string;
|
|
16
|
+
PREMADE_TEMPLATE_KEYWORDS?: string;
|
|
17
|
+
/** @deprecated Use `PREMADE_TEMPLATE_KEYWORDS`. */
|
|
18
18
|
PREMADE_TEMPLATES_KEYWORDS?: string;
|
|
19
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 {};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Nonce authentication. Passing `getNonce` switches the editor from the legacy
|
|
3
3
|
* public-key authorize call to short-lived `nc_` nonces minted on your backend.
|
|
4
|
-
* Works on its own (every feature stays
|
|
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.
|
|
5
6
|
*/
|
|
6
7
|
export interface INonceAuthCallbacks {
|
|
7
8
|
/** Fetch a fresh nc_ nonce from your authenticated backend. Never expose an sk_ secret in the browser. */
|
|
@@ -3,18 +3,25 @@ export interface ILanguageMutation {
|
|
|
3
3
|
code: string;
|
|
4
4
|
primary: boolean;
|
|
5
5
|
}
|
|
6
|
-
export interface
|
|
6
|
+
export interface IEmailSavePayload {
|
|
7
7
|
json: unknown;
|
|
8
8
|
html: unknown;
|
|
9
9
|
mutations?: ILanguageMutation[];
|
|
10
10
|
syncedSections?: number[];
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
/**
|
|
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.
|
|
17
|
+
*/
|
|
18
|
+
export type EditorErrorSource = "integration" | "init" | "authorize" | "nonceAuth" | "network" | "load" | "updateTemplate" | "save" | "testSend" | "cloudTemplates" | "cloudSync";
|
|
19
|
+
export interface IEmailErrorPayload {
|
|
20
|
+
source: EditorErrorSource;
|
|
14
21
|
message: string;
|
|
15
22
|
detail?: unknown;
|
|
16
23
|
}
|
|
17
|
-
export interface
|
|
24
|
+
export interface IEmailTestSendPayload {
|
|
18
25
|
email: string | string[];
|
|
19
26
|
json: unknown;
|
|
20
27
|
html: unknown;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type INotification from "../Notification/INotification";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ISavedSectionDraft } from "../Sections/ISections";
|
|
3
3
|
import type { ICloudCallbacks } from "../Cloud/ICloudOptions";
|
|
4
4
|
import type { INonceAuthCallbacks } from "../Auth/INonceAuthCallbacks";
|
|
5
|
-
import type {
|
|
5
|
+
import type { IEmailSavePayload, IEmailTestSendPayload, IEmailErrorPayload, ILanguageChangePayload, ILanguageMutation, IEmailDeletedItem } from "./ICallbackPayloads";
|
|
6
6
|
/** v4 host callbacks. Return save promises so the editor can await persistence. */
|
|
7
7
|
export default interface IEmailCallbacks extends INonceAuthCallbacks, ICloudCallbacks {
|
|
8
|
-
onSave?(payload:
|
|
9
|
-
onSaveAndClose?(payload:
|
|
10
|
-
onTestSend?(payload:
|
|
8
|
+
onSave?(payload: IEmailSavePayload): void | Promise<void>;
|
|
9
|
+
onSaveAndClose?(payload: IEmailSavePayload): void | Promise<void>;
|
|
10
|
+
onTestSend?(payload: IEmailTestSendPayload): void;
|
|
11
11
|
onBannerClick?(payload: {
|
|
12
12
|
json: unknown;
|
|
13
13
|
html: unknown;
|
|
@@ -15,13 +15,13 @@ export default interface IEmailCallbacks extends INonceAuthCallbacks, ICloudCall
|
|
|
15
15
|
onOpenFileManager?(): void;
|
|
16
16
|
onLoaded?(): void;
|
|
17
17
|
onSavedSectionSave?(payload: {
|
|
18
|
-
section:
|
|
18
|
+
section: ISavedSectionDraft;
|
|
19
19
|
}): void;
|
|
20
20
|
onSavedSectionRemove?(payload: {
|
|
21
|
-
id: number
|
|
21
|
+
id: number;
|
|
22
22
|
}): void;
|
|
23
23
|
onSavedSectionEdit?(payload: {
|
|
24
|
-
id: number
|
|
24
|
+
id: number;
|
|
25
25
|
}): void;
|
|
26
26
|
onImageDelete?(payload: {
|
|
27
27
|
items: IEmailDeletedItem[];
|
|
@@ -40,10 +40,25 @@ export default interface IEmailCallbacks extends INonceAuthCallbacks, ICloudCall
|
|
|
40
40
|
onAlert?(payload: {
|
|
41
41
|
notification: INotification;
|
|
42
42
|
}): void;
|
|
43
|
-
|
|
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. */
|
|
44
54
|
onEdittedWithoutSaveChanged?(payload: {
|
|
45
55
|
value: boolean;
|
|
46
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. */
|
|
47
62
|
onBlocksAndStructuresVisibilityChange?(payload: {
|
|
48
63
|
value: boolean;
|
|
49
64
|
}): void;
|
|
@@ -54,10 +69,15 @@ export default interface IEmailCallbacks extends INonceAuthCallbacks, ICloudCall
|
|
|
54
69
|
name: string;
|
|
55
70
|
}): void;
|
|
56
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. */
|
|
57
77
|
updateTestingEmailAddresses?(payload: {
|
|
58
78
|
emails: string[];
|
|
59
79
|
}): void;
|
|
60
|
-
onEditorError?(payload:
|
|
80
|
+
onEditorError?(payload: IEmailErrorPayload): void;
|
|
61
81
|
onLanguageCreated?(payload: ILanguageChangePayload): void;
|
|
62
82
|
onLanguageDeleted?(payload: ILanguageChangePayload): void;
|
|
63
83
|
onLanguageSelected?(payload: {
|
|
@@ -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;
|
|
@@ -25,8 +25,8 @@ export interface ICountdownDateMergeTag {
|
|
|
25
25
|
value: string;
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
|
-
* Countdown block settings of the host. The block itself is
|
|
29
|
-
*
|
|
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
30
|
*/
|
|
31
31
|
export interface ICountdownOptions {
|
|
32
32
|
/** Palette of newly created countdowns (any subset); unset colors keep the package defaults. */
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { IAuthorize } from "./Auth/IAuthorize";
|
|
1
2
|
import type IAPI from "./API/API";
|
|
2
3
|
import type IAPIBlockProperties from "./APIBlocks/APIBlocks";
|
|
3
4
|
import type { ISavedSection, IPremadeSectionsOptions } from "./Sections/ISections";
|
|
@@ -14,20 +15,17 @@ import type IMergeTag from "./MergeTag/IMergeTag";
|
|
|
14
15
|
import type SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
|
|
15
16
|
import type IUser from "./User/User";
|
|
16
17
|
import type IHelpdesk from "./Helpdesk/Helpdesk";
|
|
18
|
+
import type { EmailEditorShortcut } from "./Shortcuts/EditorShortcut";
|
|
17
19
|
type TopolTagAttribute = "font-family" | "font-size" | "font-weight" | "font-style" | "letter-spacing" | "text-transform" | "text-decoration" | "background-color" | "color" | "border-collapse";
|
|
18
20
|
type DefaultTemplateLangsSchema = {
|
|
19
21
|
code: string;
|
|
20
22
|
primary: boolean;
|
|
21
23
|
}[];
|
|
22
24
|
/**
|
|
23
|
-
* Configuration options for the Email Editor (
|
|
25
|
+
* Configuration options for the Email Editor: the `config` of `EmailEditor.init({ config, ...callbacks })`.
|
|
24
26
|
*/
|
|
25
27
|
export default interface IEmailConfig {
|
|
26
|
-
authorize:
|
|
27
|
-
apiKey: string;
|
|
28
|
-
/** URL-safe [A-Za-z0-9_-]+ string or a non-negative integer. */
|
|
29
|
-
userId: string | number;
|
|
30
|
-
};
|
|
28
|
+
authorize: IAuthorize;
|
|
31
29
|
aiLabeledElements?: boolean;
|
|
32
30
|
api?: IAPI;
|
|
33
31
|
apiAuthorizationHeader?: IAuthHeaderConfig | string;
|
|
@@ -40,10 +38,18 @@ export default interface IEmailConfig {
|
|
|
40
38
|
};
|
|
41
39
|
chatAI?: boolean;
|
|
42
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
|
+
};
|
|
43
49
|
cloud?: ICloudOptions;
|
|
44
50
|
colors?: Array<string>;
|
|
45
51
|
contentBlocks?: IContentBlockOptions;
|
|
46
|
-
/** Countdown block settings of the host (the block itself is gated by
|
|
52
|
+
/** Countdown block settings of the host (the block itself is gated by the add-on flag in the nonce). */
|
|
47
53
|
countdown?: ICountdownOptions;
|
|
48
54
|
currentUser?: IUser;
|
|
49
55
|
customBlocks?: ICustomBlockData[];
|
|
@@ -59,6 +65,9 @@ export default interface IEmailConfig {
|
|
|
59
65
|
defaultTemplateSettings?: {
|
|
60
66
|
emailWidth?: number;
|
|
61
67
|
emailBackgroundColor?: string;
|
|
68
|
+
/** Background color of sections. */
|
|
69
|
+
sectionBackgroundColor?: string;
|
|
70
|
+
/** @deprecated Use `sectionBackgroundColor`. */
|
|
62
71
|
blockBackgroundColor?: string;
|
|
63
72
|
buttonsBackgroundColor?: string;
|
|
64
73
|
hyperlinkColor?: string;
|
|
@@ -84,23 +93,26 @@ export default interface IEmailConfig {
|
|
|
84
93
|
text?: Record<string, unknown>;
|
|
85
94
|
column?: Record<string, unknown>;
|
|
86
95
|
section?: Record<string, unknown>;
|
|
87
|
-
|
|
96
|
+
/** Padding of sections. */
|
|
97
|
+
sectionPadding?: string;
|
|
98
|
+
lineHeight?: number;
|
|
99
|
+
stackColumns?: boolean;
|
|
100
|
+
/** @deprecated Use `sectionPadding`. */
|
|
88
101
|
"structure-margin"?: string;
|
|
102
|
+
/** @deprecated Use `lineHeight`. */
|
|
103
|
+
"line-height"?: number;
|
|
104
|
+
/** @deprecated Use `stackColumns`. */
|
|
89
105
|
"stack-columns"?: boolean;
|
|
90
106
|
langs?: DefaultTemplateLangsSchema;
|
|
91
107
|
};
|
|
92
108
|
disableAiAssistant?: boolean;
|
|
93
109
|
disableAlerts?: boolean;
|
|
94
110
|
disableExtendedComparators?: boolean;
|
|
95
|
-
|
|
111
|
+
/** `true` turns every editor keyboard shortcut off; an array only the listed ones. */
|
|
112
|
+
disableShortcuts?: boolean | EmailEditorShortcut[];
|
|
113
|
+
emailServiceProvider?: "mailchimp" | "sparkpost" | "jinja";
|
|
96
114
|
enableAutosaves?: boolean;
|
|
97
115
|
enableComments?: boolean;
|
|
98
|
-
/**
|
|
99
|
-
* Opt-in for the Countdown block, a paid add-on rolled out per user: the block only appears
|
|
100
|
-
* when the add-on flag your backend put into the editor nonce is set **and** this option is
|
|
101
|
-
* `true`, and it also needs `templateId`.
|
|
102
|
-
*/
|
|
103
|
-
enableCountdown?: boolean;
|
|
104
116
|
enableDarkMode?: boolean;
|
|
105
117
|
enableFileManagerInGif?: boolean;
|
|
106
118
|
enableSubjectLine?: boolean;
|
|
@@ -114,11 +126,13 @@ export default interface IEmailConfig {
|
|
|
114
126
|
maxUploadingFiles?: number;
|
|
115
127
|
};
|
|
116
128
|
fontSizes?: Array<number>;
|
|
117
|
-
googleApiKey?: string;
|
|
118
129
|
googlePromotionalAnnotation?: boolean;
|
|
119
130
|
helpdesk?: IHelpdesk;
|
|
120
131
|
hideSettingsTab?: boolean;
|
|
132
|
+
/** @deprecated Use `hideSelectionPanel`; it wins when both are set. */
|
|
121
133
|
hideControlPanel?: boolean;
|
|
134
|
+
hideSelectionPanel?: boolean;
|
|
135
|
+
hideSelectionPanelExpand?: boolean;
|
|
122
136
|
htmlDesktopFirst?: boolean;
|
|
123
137
|
htmlMinified?: boolean;
|
|
124
138
|
imageCompressionOptions?: {
|
|
@@ -128,12 +142,11 @@ export default interface IEmailConfig {
|
|
|
128
142
|
enableCompression?: boolean;
|
|
129
143
|
};
|
|
130
144
|
imageEditor?: boolean;
|
|
131
|
-
imageEditorV2?: boolean;
|
|
132
145
|
imageEditorOptions?: {
|
|
133
146
|
hideControls?: Array<string>;
|
|
134
147
|
};
|
|
135
148
|
imageMaxSize?: number;
|
|
136
|
-
lambdaStage?: "local" | "production" | "stage1" | "stage2" | "stage3"
|
|
149
|
+
lambdaStage?: "local" | "production" | "stage1" | "stage2" | "stage3";
|
|
137
150
|
language?: Language;
|
|
138
151
|
languageMergeTag?: string;
|
|
139
152
|
light?: boolean;
|
|
@@ -148,6 +161,11 @@ export default interface IEmailConfig {
|
|
|
148
161
|
hideSearch?: boolean;
|
|
149
162
|
showDelete?: boolean;
|
|
150
163
|
};
|
|
164
|
+
productMergeTags?: {
|
|
165
|
+
label: string;
|
|
166
|
+
value: string;
|
|
167
|
+
}[];
|
|
168
|
+
/** @deprecated Use `productMergeTags`. */
|
|
151
169
|
productMergetagTags?: {
|
|
152
170
|
label: string;
|
|
153
171
|
value: string;
|
|
@@ -166,9 +184,16 @@ export default interface IEmailConfig {
|
|
|
166
184
|
showArticleBlock?: boolean;
|
|
167
185
|
};
|
|
168
186
|
removeTopBar?: boolean;
|
|
187
|
+
/**
|
|
188
|
+
* How Save and Save & Close are laid out when both are visible: `"dropdown"` (default) tucks
|
|
189
|
+
* Save & Close under the Save button's menu, `"separate"` renders two standalone buttons.
|
|
190
|
+
* Ignored when either button is hidden via `hideTopbarControls`.
|
|
191
|
+
*/
|
|
192
|
+
saveAndCloseButton?: "dropdown" | "separate";
|
|
169
193
|
renameTemplate?: boolean;
|
|
170
194
|
role?: "manager" | "editor" | "reader";
|
|
171
195
|
savedSections?: ISavedSection[] | boolean | null;
|
|
196
|
+
/** @deprecated Use `hideSelectionPanelExpand` (inverted); it wins when both are set. */
|
|
172
197
|
showControlPanelExpand?: boolean;
|
|
173
198
|
showUnsavedDialogBeforeExit?: boolean;
|
|
174
199
|
smartMergeTags?: {
|
|
@@ -179,6 +204,7 @@ export default interface IEmailConfig {
|
|
|
179
204
|
end: string;
|
|
180
205
|
};
|
|
181
206
|
};
|
|
207
|
+
startWithOpenElementsPanel?: boolean;
|
|
182
208
|
syncedSectionsEnabled?: boolean;
|
|
183
209
|
teamUsers?: IUser[];
|
|
184
210
|
templateId?: number | string;
|
|
@@ -11,9 +11,15 @@ export interface IUpdateTemplateOptions {
|
|
|
11
11
|
export default interface IEmailEditorInstance {
|
|
12
12
|
render(container: string | HTMLElement): Promise<void>;
|
|
13
13
|
destroy(): Promise<void>;
|
|
14
|
+
/** Alias of destroy(), the name the script-tag instance has always had. */
|
|
15
|
+
close(): Promise<void>;
|
|
14
16
|
/** Resolves once the template is actually applied. */
|
|
15
17
|
load: (json: unknown) => Promise<void>;
|
|
16
|
-
/**
|
|
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
|
+
*/
|
|
17
23
|
save: (payload?: {
|
|
18
24
|
langCode?: string;
|
|
19
25
|
}) => Promise<void>;
|
|
@@ -29,12 +35,18 @@ export default interface IEmailEditorInstance {
|
|
|
29
35
|
setActiveMembers: (activeMembers: string[]) => Promise<void>;
|
|
30
36
|
changeEmailToMobile: () => Promise<void>;
|
|
31
37
|
changeEmailToDesktop: () => Promise<void>;
|
|
38
|
+
toggleHiddenElementsVisibility: () => Promise<void>;
|
|
39
|
+
/** @deprecated Use `toggleHiddenElementsVisibility`. */
|
|
32
40
|
toggleBlocksAndStructuresVisibility: () => Promise<void>;
|
|
33
41
|
updateCustomBlockContent: (content: string) => Promise<void>;
|
|
34
42
|
refreshComments: (key: string) => Promise<void>;
|
|
35
43
|
refreshSyncedSections: () => Promise<void>;
|
|
36
44
|
openPremadeTemplatesSelection: () => Promise<void>;
|
|
37
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Update the authorization header of all later API calls. An object is merged into the
|
|
47
|
+
* current header; a `null` value removes that header.
|
|
48
|
+
*/
|
|
49
|
+
updateApiAuthorizationHeader: (newHeader: string | Record<string, string | null>) => Promise<void>;
|
|
38
50
|
setTemplateName: (name: string) => Promise<void>;
|
|
39
51
|
updateOptions: (topolOptions: Partial<Omit<IEmailConfig, "authorize">>) => Promise<void>;
|
|
40
52
|
setMergeTags: (mergeTags: Array<IMergeTag | IMergeTagGroup>) => Promise<void>;
|
|
@@ -49,6 +61,8 @@ export default interface IEmailEditorInstance {
|
|
|
49
61
|
translateAllLanguages: () => Promise<void>;
|
|
50
62
|
/** Returns the template's language mutations (also fires onGetMutations). */
|
|
51
63
|
getMutations: () => Promise<ILanguageMutation[]>;
|
|
64
|
+
toggleSelectionPanel: () => Promise<void>;
|
|
65
|
+
/** @deprecated Use `toggleSelectionPanel`. */
|
|
52
66
|
toggleControlPanel: () => Promise<void>;
|
|
53
67
|
updateTemplate: (json: unknown, options?: IUpdateTemplateOptions) => Promise<void>;
|
|
54
68
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type IEmailConfig from "./IEmailConfig";
|
|
2
2
|
import type IEmailCallbacks from "./Callbacks/IEmailCallbacks";
|
|
3
3
|
/** Email Editor v4 factory props. Callbacks live alongside config. */
|
|
4
|
-
export default interface
|
|
4
|
+
export default interface IEmailOptions extends IEmailCallbacks {
|
|
5
5
|
config: IEmailConfig;
|
|
6
6
|
}
|
|
7
7
|
export type { IEmailCallbacks };
|
|
@@ -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
|
}
|
|
@@ -7,6 +7,8 @@ export interface ISavedSection {
|
|
|
7
7
|
translation?: unknown;
|
|
8
8
|
children?: ISavedSection[];
|
|
9
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">;
|
|
10
12
|
export interface IPremadeSection {
|
|
11
13
|
name?: string;
|
|
12
14
|
img?: string;
|
|
@@ -24,7 +26,16 @@ export interface ILegacyPremadeSections {
|
|
|
24
26
|
footers?: IPremadeSection[];
|
|
25
27
|
headers?: IPremadeSection[];
|
|
26
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
|
+
}
|
|
27
38
|
export type IPremadeSectionsOptions = false | IPremadeSections | ILegacyPremadeSections | {
|
|
28
|
-
blocks: IPremadeSections | ILegacyPremadeSections;
|
|
39
|
+
blocks: Array<IPremadeSections[number] | IPremadePreset> | ILegacyPremadeSections;
|
|
29
40
|
override: boolean;
|
|
30
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";
|