@topol.io/editor 1.0.0-alpha.0 → 1.0.0-alpha.10
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 +150 -101
- package/dist/topol-plugin.es.js +131 -190
- 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 +15 -90
- package/dist/types/src/landing-page-editor/index.d.ts +18 -6
- package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +1 -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 +89 -0
- package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +816 -816
- package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +612 -612
- package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +816 -816
- package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +2 -2
- package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +2 -2
- package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +6 -6
- package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +2 -2
- package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +2 -2
- package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +92 -92
- package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +94 -94
- package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +204 -204
- package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +804 -804
- package/dist/types/src/main.d.ts +14 -68
- package/dist/types/types/API/API.d.ts +8 -7
- package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +9 -0
- package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +20 -17
- package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +65 -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 +199 -0
- package/dist/types/types/IEmailEditorInstance.d.ts +54 -0
- package/dist/types/types/ITopolOptions.d.ts +4 -120
- package/dist/types/types/ITopolPlugin.d.ts +2 -37
- package/dist/types/types/Language/Language.d.ts +6 -1
- package/dist/types/types/SavedBlock/ISavedBlock.d.ts +2 -6
- package/dist/types/types/Sections/ISections.d.ts +30 -0
- package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +12 -4
- package/dist/types/types/landing-page/ILandingPageOptions.d.ts +96 -58
- package/package.json +10 -13
- package/dist/topol-plugin.umd.js +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type IEmailConfig from "./IEmailConfig";
|
|
2
|
+
import type INotification from "./Notification/INotification";
|
|
3
|
+
import type { ISavedSection } from "./Sections/ISections";
|
|
4
|
+
import type IMergeTag from "./MergeTag/IMergeTag";
|
|
5
|
+
import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
|
|
6
|
+
import type { ILanguageMutation } from "./Callbacks/ICallbackPayloads";
|
|
7
|
+
export interface IUpdateTemplateOptions {
|
|
8
|
+
skipSnapshot?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** Per-instance methods cross the iframe boundary asynchronously. Use onInit to observe successful authentication. */
|
|
11
|
+
export default interface IEmailEditorInstance {
|
|
12
|
+
render(container: string | HTMLElement): Promise<void>;
|
|
13
|
+
destroy(): Promise<void>;
|
|
14
|
+
/** Resolves once the template is actually applied. */
|
|
15
|
+
load: (json: unknown) => Promise<void>;
|
|
16
|
+
/** Resolves once the save (render/persist + host onSave) has settled. */
|
|
17
|
+
save: (payload?: {
|
|
18
|
+
langCode?: string;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
togglePreview: () => Promise<void>;
|
|
21
|
+
togglePreviewSize: () => Promise<void>;
|
|
22
|
+
toggleDarkMode: () => Promise<void>;
|
|
23
|
+
chooseFile: (url: string) => Promise<void>;
|
|
24
|
+
undo: () => Promise<void>;
|
|
25
|
+
redo: () => Promise<void>;
|
|
26
|
+
setSavedSections: (savedSections: ISavedSection[]) => Promise<void>;
|
|
27
|
+
setPreviewHTML: (html: unknown) => Promise<void>;
|
|
28
|
+
createNotification: (notification: INotification) => Promise<void>;
|
|
29
|
+
setActiveMembers: (activeMembers: string[]) => Promise<void>;
|
|
30
|
+
changeEmailToMobile: () => Promise<void>;
|
|
31
|
+
changeEmailToDesktop: () => Promise<void>;
|
|
32
|
+
toggleBlocksAndStructuresVisibility: () => Promise<void>;
|
|
33
|
+
updateCustomBlockContent: (content: string) => Promise<void>;
|
|
34
|
+
refreshComments: (key: string) => Promise<void>;
|
|
35
|
+
refreshSyncedSections: () => Promise<void>;
|
|
36
|
+
openPremadeTemplatesSelection: () => Promise<void>;
|
|
37
|
+
updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => Promise<void>;
|
|
38
|
+
setTemplateName: (name: string) => Promise<void>;
|
|
39
|
+
updateOptions: (topolOptions: Partial<Omit<IEmailConfig, "authorize">>) => Promise<void>;
|
|
40
|
+
setMergeTags: (mergeTags: Array<IMergeTag | IMergeTagGroup>) => Promise<void>;
|
|
41
|
+
toggleChatAI: () => Promise<void>;
|
|
42
|
+
toggleAutosaves: () => Promise<void>;
|
|
43
|
+
toggleComments: () => Promise<void>;
|
|
44
|
+
createLanguage: (code: string) => Promise<void>;
|
|
45
|
+
setPrimaryLanguage: (code: string) => Promise<void>;
|
|
46
|
+
deleteLanguage: (code: string) => Promise<void>;
|
|
47
|
+
selectLanguage: (code: string) => Promise<void>;
|
|
48
|
+
translateLanguage: (code: string, sourceCode?: string) => Promise<void>;
|
|
49
|
+
translateAllLanguages: () => Promise<void>;
|
|
50
|
+
/** Returns the template's language mutations (also fires onGetMutations). */
|
|
51
|
+
getMutations: () => Promise<ILanguageMutation[]>;
|
|
52
|
+
toggleControlPanel: () => Promise<void>;
|
|
53
|
+
updateTemplate: (json: unknown, options?: IUpdateTemplateOptions) => Promise<void>;
|
|
54
|
+
}
|
|
@@ -1,123 +1,7 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type IAPIBlockProperties from "./APIBlocks/APIBlocks";
|
|
3
|
-
import type ISavedBlock from "./SavedBlock/ISavedBlock";
|
|
4
|
-
import type IMergeTagGroup from "./MergeTag/IMergeTagGroup";
|
|
5
|
-
import type { IContentBlockOptions } from "./ContentBlock/IContentBlockOptions";
|
|
6
|
-
import type ITheme from "./Theme/ITheme";
|
|
7
|
-
import type IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
|
|
8
|
-
import type IFont from "./Font/IFont";
|
|
9
|
-
import type ICustomBlockData from "./CustomBlocks/CustomBlocks";
|
|
10
|
-
import type { Language } from "./Language/Language";
|
|
11
|
-
import type IMergeTag from "./MergeTag/IMergeTag";
|
|
12
|
-
import type SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
|
|
13
|
-
import type IUser from "./User/User";
|
|
14
|
-
import type IHelpdesk from "./Helpdesk/Helpdesk";
|
|
1
|
+
import type IEmailConfig from "./IEmailConfig";
|
|
15
2
|
import type IEmailCallbacks from "./Callbacks/IEmailCallbacks";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
*/
|
|
20
|
-
export default interface ITopolOptions {
|
|
21
|
-
id: string;
|
|
22
|
-
authorize: {
|
|
23
|
-
apiKey: string;
|
|
24
|
-
userId: string | number;
|
|
25
|
-
};
|
|
26
|
-
api?: IAPI;
|
|
27
|
-
apiAuthorizationHeader?: IAuthHeaderConfig | string;
|
|
28
|
-
apiBlocks?: Record<string, IAPIBlockProperties>;
|
|
29
|
-
autosaveInterval?: number;
|
|
30
|
-
betaFeatures?: {
|
|
31
|
-
carousel?: boolean;
|
|
32
|
-
};
|
|
33
|
-
chatAI?: boolean;
|
|
34
|
-
colors?: Array<string>;
|
|
35
|
-
contentBlocks?: IContentBlockOptions;
|
|
36
|
-
currentUser?: IUser;
|
|
37
|
-
customBlocks?: ICustomBlockData[];
|
|
38
|
-
customFileManager?: boolean;
|
|
39
|
-
customFonts?: {
|
|
40
|
-
override?: boolean;
|
|
41
|
-
fonts: Array<IFont>;
|
|
42
|
-
};
|
|
43
|
-
defaultTemplateSettings?: {
|
|
44
|
-
emailWidth?: number;
|
|
45
|
-
emailBackgroundColor?: string;
|
|
46
|
-
blockBackgroundColor?: string;
|
|
47
|
-
buttonsBackgroundColor?: string;
|
|
48
|
-
hyperlinkColor?: string;
|
|
49
|
-
h1?: {
|
|
50
|
-
[key in TopolTagAttribute]?: string;
|
|
51
|
-
};
|
|
52
|
-
h2?: {
|
|
53
|
-
[key in TopolTagAttribute]?: string;
|
|
54
|
-
};
|
|
55
|
-
h3?: {
|
|
56
|
-
[key in TopolTagAttribute]?: string;
|
|
57
|
-
};
|
|
58
|
-
p?: {
|
|
59
|
-
[key in TopolTagAttribute]?: string;
|
|
60
|
-
};
|
|
61
|
-
button?: {
|
|
62
|
-
[key in TopolTagAttribute]?: string;
|
|
63
|
-
};
|
|
64
|
-
"line-height"?: number;
|
|
65
|
-
"structure-margin"?: string;
|
|
66
|
-
};
|
|
67
|
-
disableAiAssistant?: boolean;
|
|
68
|
-
disableAlerts?: boolean;
|
|
69
|
-
disableExtendedComparators?: boolean;
|
|
70
|
-
emailServiceProvider?: "mailchimp" | "sparkpost";
|
|
71
|
-
enableAutosaves?: boolean;
|
|
72
|
-
enableComments?: boolean;
|
|
73
|
-
enableImageToTextRatio?: boolean;
|
|
74
|
-
enableMergeTagPreview?: boolean;
|
|
75
|
-
enableSectionVariants?: boolean;
|
|
76
|
-
enableTemplateSizeInfo?: boolean;
|
|
77
|
-
fontSizes?: Array<number>;
|
|
78
|
-
googleApiKey?: string;
|
|
79
|
-
helpdesk?: IHelpdesk;
|
|
80
|
-
hideSettingsTab?: boolean;
|
|
81
|
-
htmlDesktopFirst?: boolean;
|
|
82
|
-
htmlMinified?: boolean;
|
|
83
|
-
imageCompressionOptions?: {
|
|
84
|
-
qualityJpeg?: number;
|
|
85
|
-
qualityPng?: number;
|
|
86
|
-
enableAutoResize?: boolean;
|
|
87
|
-
enableCompression?: boolean;
|
|
88
|
-
};
|
|
89
|
-
imageEditor?: boolean;
|
|
90
|
-
imageMaxSize?: number;
|
|
91
|
-
language?: Language;
|
|
92
|
-
light?: boolean;
|
|
93
|
-
logicalOperatorsInsideVariant?: boolean;
|
|
94
|
-
mainMenuAlign?: "left" | "right";
|
|
95
|
-
mergeTags?: Array<IMergeTagGroup | IMergeTag>;
|
|
96
|
-
mobileFirstEnabled?: boolean;
|
|
97
|
-
premadeBlocks?: Record<any, any> | boolean;
|
|
98
|
-
premadeTemplates?: boolean;
|
|
99
|
-
role?: "manager" | "editor" | "reader";
|
|
100
|
-
savedBlocks?: Array<ISavedBlock> | boolean;
|
|
101
|
-
showUnsavedDialogBeforeExit?: boolean;
|
|
102
|
-
smartMergeTags?: {
|
|
103
|
-
enabled: boolean;
|
|
104
|
-
patterns?: Record<string, SmartMergeTagPattern>;
|
|
105
|
-
syntax?: {
|
|
106
|
-
start: string;
|
|
107
|
-
end: string;
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
syncedRowsEnable?: boolean;
|
|
111
|
-
teamUsers?: IUser[];
|
|
112
|
-
templateId?: number | string;
|
|
113
|
-
testingEmails?: boolean | string[];
|
|
114
|
-
theme?: ITheme;
|
|
115
|
-
tinyConfig?: unknown;
|
|
116
|
-
title?: string;
|
|
117
|
-
topBarOptions?: Array<string>;
|
|
118
|
-
renameTemplate?: boolean;
|
|
119
|
-
removeTopBar?: boolean;
|
|
120
|
-
windowBar?: Array<string>;
|
|
121
|
-
callbacks: IEmailCallbacks;
|
|
3
|
+
/** Email Editor v4 factory props. Callbacks live alongside config. */
|
|
4
|
+
export default interface ITopolOptions extends IEmailCallbacks {
|
|
5
|
+
config: IEmailConfig;
|
|
122
6
|
}
|
|
123
7
|
export type { IEmailCallbacks };
|
|
@@ -1,37 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import ITopolOptions from "./ITopolOptions";
|
|
4
|
-
import IMergeTagGroup from "./MergeTag/IMergeTagGroup";
|
|
5
|
-
import IMergeTag from "./MergeTag/IMergeTag";
|
|
6
|
-
export default interface ITopolPlugin {
|
|
7
|
-
init: (topolOptions: ITopolOptions) => void;
|
|
8
|
-
save: () => void;
|
|
9
|
-
load: (json: unknown) => void;
|
|
10
|
-
togglePreview: () => void;
|
|
11
|
-
togglePreviewSize: () => void;
|
|
12
|
-
chooseFile: (url: string) => void;
|
|
13
|
-
undo: () => void;
|
|
14
|
-
redo: () => void;
|
|
15
|
-
destroy: () => void;
|
|
16
|
-
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
17
|
-
setPreviewHTML: (html: unknown) => void;
|
|
18
|
-
createNotification: (notification: INotification) => void;
|
|
19
|
-
setActiveMembers: (activeMemers: string[]) => void;
|
|
20
|
-
changeEmailToMobile: () => void;
|
|
21
|
-
changeEmailToDesktop: () => void;
|
|
22
|
-
toggleBlocksAndStructuresVisibility: () => void;
|
|
23
|
-
updateCustomBlockContent: (content: string) => void;
|
|
24
|
-
refreshComments: (key: string) => void;
|
|
25
|
-
refreshSyncedRows: () => void;
|
|
26
|
-
openPremadeTemplatesSelection: () => void;
|
|
27
|
-
updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
|
|
28
|
-
setTemplateName: (name: string) => void;
|
|
29
|
-
setMergeTags: (mergeTags: Array<IMergeTagGroup | IMergeTag>) => void;
|
|
30
|
-
toggleChatAI: () => void;
|
|
31
|
-
toggleAutosaves: () => void;
|
|
32
|
-
toggleComments: () => void;
|
|
33
|
-
createLanguage: (lang: string) => void;
|
|
34
|
-
setPrimaryLanguage: (lang: string) => void;
|
|
35
|
-
deleteLanguage: (lang: string) => void;
|
|
36
|
-
selectLanguage: (lang: string) => void;
|
|
37
|
-
}
|
|
1
|
+
/** @deprecated Use IEmailEditorInstance. */
|
|
2
|
+
export type { default } from "./IEmailEditorInstance";
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export type Language = "en" | "fr" | "pt" | "es" | "ja" | "zh" | "ru" | "tr" | "de" | "sv" | "nl" | "it" | "fi" | "ro" | "cs" | "pl" | "ko" | "vi" | "he";
|
|
1
|
+
export type Language = "en" | "fr" | "pt" | "es" | "ja" | "zh" | "ru" | "tr" | "de" | "sv" | "nl" | "it" | "fi" | "ro" | "cs" | "pl" | "ko" | "vi" | "he" | "ar" | "sk";
|
|
2
|
+
export type IMultilingualLanguage = {
|
|
3
|
+
name: string;
|
|
4
|
+
code: string;
|
|
5
|
+
nativeName: string;
|
|
6
|
+
}[];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/** Reusable section. Template definitions and translations are opaque JSON. */
|
|
2
|
+
export interface ISavedSection {
|
|
3
|
+
id: number;
|
|
4
|
+
name: string;
|
|
5
|
+
img?: string | null;
|
|
6
|
+
definition: unknown;
|
|
7
|
+
translation?: unknown;
|
|
8
|
+
children?: ISavedSection[];
|
|
9
|
+
}
|
|
10
|
+
export interface IPremadeSection {
|
|
11
|
+
name?: string;
|
|
12
|
+
img?: string;
|
|
13
|
+
definition: unknown;
|
|
14
|
+
translation?: unknown;
|
|
15
|
+
}
|
|
16
|
+
export type IPremadeSections = {
|
|
17
|
+
id?: number;
|
|
18
|
+
name: string;
|
|
19
|
+
blocks: IPremadeSection[];
|
|
20
|
+
}[];
|
|
21
|
+
export interface ILegacyPremadeSections {
|
|
22
|
+
content?: IPremadeSection[];
|
|
23
|
+
ecomm?: IPremadeSection[];
|
|
24
|
+
footers?: IPremadeSection[];
|
|
25
|
+
headers?: IPremadeSection[];
|
|
26
|
+
}
|
|
27
|
+
export type IPremadeSectionsOptions = false | IPremadeSections | ILegacyPremadeSections | {
|
|
28
|
+
blocks: IPremadeSections | ILegacyPremadeSections;
|
|
29
|
+
override: boolean;
|
|
30
|
+
};
|
|
@@ -1,19 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Instance of the Landing Page Editor returned by
|
|
2
|
+
* Instance of the Landing Page Editor returned by LandingPageEditor.init().
|
|
3
3
|
*/
|
|
4
4
|
export default interface ILandingPageEditorInstance {
|
|
5
5
|
/**
|
|
6
6
|
* Render the editor into a container element.
|
|
7
|
-
*
|
|
7
|
+
*
|
|
8
|
+
* The returned promise resolves once the editor iframe has been rendered and
|
|
9
|
+
* rejects if the container cannot be found or the instance was destroyed meanwhile.
|
|
10
|
+
*
|
|
11
|
+
* @param container - CSS selector for the container element (e.g., "#landing-page-editor") or the element itself
|
|
8
12
|
*/
|
|
9
|
-
render(
|
|
13
|
+
render(container: string | HTMLElement): Promise<void>;
|
|
10
14
|
/**
|
|
11
15
|
* Load a template into the editor.
|
|
12
16
|
* @param template - The template data (JSON structure)
|
|
13
17
|
*/
|
|
14
18
|
load(template: unknown): void;
|
|
19
|
+
/**
|
|
20
|
+
* Trigger the save callback with current editor content.
|
|
21
|
+
*/
|
|
22
|
+
save(): void;
|
|
15
23
|
/**
|
|
16
24
|
* Destroy the editor instance and clean up resources.
|
|
17
25
|
*/
|
|
18
|
-
destroy(): void
|
|
26
|
+
destroy(): Promise<void>;
|
|
19
27
|
}
|
|
@@ -3,102 +3,140 @@
|
|
|
3
3
|
* Re-exports the IPluginOptions from the schema with additional callbacks.
|
|
4
4
|
*/
|
|
5
5
|
import type { IPluginOptions } from "../../src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema";
|
|
6
|
-
import type { TopolSection } from "../../src/landing-page-editor/schemas/template/structure/sectionSchema";
|
|
7
6
|
import type { INotification } from "../../src/landing-page-editor/schemas/notification/notificationSchema";
|
|
7
|
+
/**
|
|
8
|
+
* Payload of `onSave` and `onSaveAndClose`.
|
|
9
|
+
*/
|
|
10
|
+
export interface ILandingPageSavePayload {
|
|
11
|
+
/** The landing page JSON structure (template definition). */
|
|
12
|
+
json: unknown;
|
|
13
|
+
/** The rendered page HTML. */
|
|
14
|
+
html: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A file or folder deleted in the built-in file manager (`onImageDelete`).
|
|
18
|
+
*/
|
|
19
|
+
export interface ILandingPageDeletedItem {
|
|
20
|
+
name: string;
|
|
21
|
+
type: "file" | "folder";
|
|
22
|
+
path: string;
|
|
23
|
+
url?: string;
|
|
24
|
+
key: string | null;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Payload of `onEditorError`.
|
|
28
|
+
*/
|
|
29
|
+
export interface ILandingPageErrorPayload {
|
|
30
|
+
/** Where the error originated. `"init"` is emitted by the framework wrappers when `init()` rejects. */
|
|
31
|
+
source: "authorize" | "network" | "templateLoad" | "init" | (string & {});
|
|
32
|
+
/** Human-readable description. */
|
|
33
|
+
message: string;
|
|
34
|
+
/** Raw error data when available (for `network` errors, the response body). */
|
|
35
|
+
detail?: unknown;
|
|
36
|
+
}
|
|
8
37
|
/**
|
|
9
38
|
* Callback functions for Landing Page Editor events.
|
|
39
|
+
*
|
|
40
|
+
* Every callback receives at most one argument: a payload object with named
|
|
41
|
+
* properties. New fields can be added to a payload without breaking handlers,
|
|
42
|
+
* so destructure what you need and ignore the rest. Callbacks that carry no
|
|
43
|
+
* data are called with no arguments.
|
|
10
44
|
*/
|
|
11
45
|
export interface ILandingPageCallbacks {
|
|
12
46
|
/**
|
|
13
47
|
* Called when the user saves the landing page.
|
|
14
|
-
*
|
|
15
|
-
*
|
|
48
|
+
* May return a Promise: the editor keeps its saving state until it settles and a
|
|
49
|
+
* rejection is shown as a save error. A Promise that never settles is released after
|
|
50
|
+
* a timeout with a console warning.
|
|
16
51
|
*/
|
|
17
|
-
onSave?(
|
|
52
|
+
onSave?(payload: ILandingPageSavePayload): void | Promise<void>;
|
|
18
53
|
/**
|
|
19
|
-
* Called when the user clicks "Save and Close".
|
|
20
|
-
*
|
|
21
|
-
*
|
|
54
|
+
* Called when the user clicks "Save and Close". Same payload and Promise handling as
|
|
55
|
+
* `onSave`; a rejection keeps the editor open. Closing the editor UI is your job here.
|
|
56
|
+
* When not defined, the payload goes to `onSave` and the editor iframe is removed afterwards.
|
|
22
57
|
*/
|
|
23
|
-
onSaveAndClose?(
|
|
24
|
-
/**
|
|
25
|
-
* Called when the editor has finished loading.
|
|
26
|
-
*/
|
|
27
|
-
onLoaded?(): void;
|
|
58
|
+
onSaveAndClose?(payload: ILandingPageSavePayload): void | Promise<void>;
|
|
28
59
|
/**
|
|
29
|
-
* Called when the
|
|
30
|
-
*/
|
|
31
|
-
onInit?(): void;
|
|
32
|
-
/**
|
|
33
|
-
* Called when the user closes the editor.
|
|
60
|
+
* Called when the custom file manager should be opened.
|
|
34
61
|
*/
|
|
35
|
-
|
|
62
|
+
onOpenFileManager?(): void;
|
|
36
63
|
/**
|
|
37
|
-
* Called when the
|
|
38
|
-
*
|
|
39
|
-
* @param html - The generated HTML output
|
|
64
|
+
* Called when files or folders are deleted in the built-in file manager, so the
|
|
65
|
+
* deletion can be mirrored in your own storage.
|
|
40
66
|
*/
|
|
41
|
-
|
|
67
|
+
onImageDelete?(payload: {
|
|
68
|
+
items: ILandingPageDeletedItem[];
|
|
69
|
+
}): void;
|
|
42
70
|
/**
|
|
43
|
-
* Called
|
|
71
|
+
* Called after a template has been loaded into the editor via `load()`.
|
|
72
|
+
*
|
|
73
|
+
* Note: this is NOT an "editor ready" signal; use `onInit` for that.
|
|
44
74
|
*/
|
|
45
|
-
|
|
75
|
+
onLoaded?(): void;
|
|
46
76
|
/**
|
|
47
|
-
* Called
|
|
48
|
-
* @param block - The saved block section
|
|
77
|
+
* Called once the editor is fully initialized and ready.
|
|
49
78
|
*/
|
|
50
|
-
|
|
79
|
+
onInit?(): void;
|
|
51
80
|
/**
|
|
52
|
-
* Called when
|
|
53
|
-
* @param blockId - The ID of the removed block
|
|
81
|
+
* Called when the undo stack changes. `count` is the number of undo steps available.
|
|
54
82
|
*/
|
|
55
|
-
|
|
83
|
+
onUndoChange?(payload: {
|
|
84
|
+
count: number;
|
|
85
|
+
}): void;
|
|
56
86
|
/**
|
|
57
|
-
* Called when
|
|
58
|
-
* @param blockId - The ID of the block being edited
|
|
87
|
+
* Called when the redo stack changes. `count` is the number of redo steps available.
|
|
59
88
|
*/
|
|
60
|
-
|
|
89
|
+
onRedoChange?(payload: {
|
|
90
|
+
count: number;
|
|
91
|
+
}): void;
|
|
61
92
|
/**
|
|
62
|
-
* Called when the
|
|
63
|
-
* @param count - Number of undo steps available
|
|
93
|
+
* Called when the user requests a preview. `html` is the rendered page.
|
|
64
94
|
*/
|
|
65
|
-
|
|
95
|
+
onPreview?(payload: {
|
|
96
|
+
html: string;
|
|
97
|
+
}): void;
|
|
66
98
|
/**
|
|
67
|
-
* Called when the
|
|
68
|
-
* @param count - Number of redo steps available
|
|
99
|
+
* Called when the preview is closed.
|
|
69
100
|
*/
|
|
70
|
-
|
|
101
|
+
onPreviewClose?(): void;
|
|
71
102
|
/**
|
|
72
|
-
* Called when
|
|
73
|
-
* @param html - The preview HTML
|
|
103
|
+
* Called when an alert/notification is triggered.
|
|
74
104
|
*/
|
|
75
|
-
|
|
105
|
+
onAlert?(payload: {
|
|
106
|
+
notification: INotification;
|
|
107
|
+
}): void;
|
|
76
108
|
/**
|
|
77
|
-
* Called when
|
|
78
|
-
*
|
|
109
|
+
* Called when the user closes the editor from the window bar. Closing the editor UI is
|
|
110
|
+
* your job in this handler. May return a Promise; the editor waits for it before teardown.
|
|
111
|
+
*
|
|
112
|
+
* Named `onEditorClose` because the underlying loader reserves `onClose` for its own
|
|
113
|
+
* lifecycle. It is NOT invoked when the host tears the editor down via `destroy()`.
|
|
79
114
|
*/
|
|
80
|
-
|
|
115
|
+
onEditorClose?(): void | Promise<void>;
|
|
81
116
|
/**
|
|
82
|
-
* Called when the
|
|
83
|
-
* @param hasChanges - Whether there are unsaved changes
|
|
117
|
+
* Called when the unsaved-changes state flips. `value` is `true` while there are unsaved edits.
|
|
84
118
|
*/
|
|
85
|
-
onEdittedWithoutSaveChanged?(
|
|
119
|
+
onEdittedWithoutSaveChanged?(payload: {
|
|
120
|
+
value: boolean;
|
|
121
|
+
}): void;
|
|
86
122
|
/**
|
|
87
|
-
* Called when a custom block dialog should be opened.
|
|
88
|
-
* @param blockData - The custom block data
|
|
123
|
+
* Called when a custom block dialog should be opened. `block` is the custom block data.
|
|
89
124
|
*/
|
|
90
|
-
onOpenCustomBlockDialog?(
|
|
125
|
+
onOpenCustomBlockDialog?(payload: {
|
|
126
|
+
block: unknown;
|
|
127
|
+
}): void;
|
|
91
128
|
/**
|
|
92
|
-
* Called when the
|
|
93
|
-
* @param newName - The new template name
|
|
129
|
+
* Called when the user clicks the rename button. `name` is the current template name.
|
|
94
130
|
*/
|
|
95
|
-
onTemplateRename?(
|
|
131
|
+
onTemplateRename?(payload: {
|
|
132
|
+
name: string;
|
|
133
|
+
}): void;
|
|
96
134
|
/**
|
|
97
|
-
* Called when an error occurs.
|
|
98
|
-
*
|
|
99
|
-
*
|
|
135
|
+
* Called when an error occurs in the editor.
|
|
136
|
+
*
|
|
137
|
+
* Named `onEditorError` because the underlying loader reserves `onError` for its own lifecycle.
|
|
100
138
|
*/
|
|
101
|
-
|
|
139
|
+
onEditorError?(payload: ILandingPageErrorPayload): void;
|
|
102
140
|
}
|
|
103
141
|
/**
|
|
104
142
|
* Configuration options for the Landing Page Editor.
|
package/package.json
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"author": "Topol.io",
|
|
13
13
|
"homepage": "https://topol.io",
|
|
14
14
|
"license": "Apache-2.0",
|
|
15
|
-
"version": "1.0.0-alpha.
|
|
15
|
+
"version": "1.0.0-alpha.10",
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
@@ -23,24 +23,19 @@
|
|
|
23
23
|
".": {
|
|
24
24
|
"types": "./dist/types/src/main.d.ts",
|
|
25
25
|
"import": "./dist/topol-plugin.es.js",
|
|
26
|
-
"require": "./dist/topol-plugin.umd.
|
|
26
|
+
"require": "./dist/topol-plugin.umd.cjs"
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.6.5",
|
|
31
|
-
"@typescript-eslint/eslint-plugin": "^6.7.2",
|
|
32
|
-
"@typescript-eslint/parser": "^6.7.2",
|
|
33
|
-
"eslint": "^8.50.0",
|
|
34
|
-
"eslint-config-prettier": "^9.0.0",
|
|
35
31
|
"happy-dom": "^20.0.11",
|
|
36
|
-
"prettier": "3.1.1",
|
|
37
32
|
"typescript": "^5.2.2",
|
|
38
33
|
"vite": "^5.0.11",
|
|
39
|
-
"vitest": "^4.0.16"
|
|
40
|
-
"zod": "^4.3.5"
|
|
34
|
+
"vitest": "^4.0.16"
|
|
41
35
|
},
|
|
42
36
|
"dependencies": {
|
|
43
|
-
"load-script": "^2.0.0"
|
|
37
|
+
"load-script": "^2.0.0",
|
|
38
|
+
"zod": "^4.3.5"
|
|
44
39
|
},
|
|
45
40
|
"publishConfig": {
|
|
46
41
|
"access": "public"
|
|
@@ -49,10 +44,12 @@
|
|
|
49
44
|
"dev": "vite",
|
|
50
45
|
"build-watch": "vite build --watch",
|
|
51
46
|
"build-with-types": "vite build && pnpm run build:types",
|
|
52
|
-
"lint": "
|
|
53
|
-
"format": "
|
|
47
|
+
"lint": "oxlint --deny-warnings .",
|
|
48
|
+
"format": "oxfmt --write .",
|
|
54
49
|
"build:types": "tsc -p tsconfig.prod.json",
|
|
55
50
|
"test": "vitest run",
|
|
56
|
-
"test:watch": "vitest"
|
|
51
|
+
"test:watch": "vitest",
|
|
52
|
+
"lint:fix": "oxlint --fix --deny-warnings .",
|
|
53
|
+
"format:check": "oxfmt --check ."
|
|
57
54
|
}
|
|
58
55
|
}
|
package/dist/topol-plugin.umd.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l["topol-plugin"]={}))})(this,function(l){"use strict";function u(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var T=function(n,o,i){var a=document.head||document.getElementsByTagName("head")[0],t=document.createElement("script");typeof o=="function"&&(i=o,o={}),o=o||{},i=i||function(){},t.type=o.type||"text/javascript",t.charset=o.charset||"utf8",t.async="async"in o?!!o.async:!0,t.src=n,o.attrs&&P(t,o.attrs),o.text&&(t.text=""+o.text);var s="onload"in t?c:f;s(t,i),t.onload||c(t,i),a.appendChild(t)};function P(e,n){for(var o in n)e.setAttribute(o,n[o])}function c(e,n){e.onload=function(){this.onerror=this.onload=null,n(null,e)},e.onerror=function(){this.onerror=this.onload=null,n(new Error("Failed to load "+this.src),e)}}function f(e,n){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,n(null,e))}}const d=u(T);var g={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const r={production:g.VITE_TOPOL_URL,dev:g.VITE_TOPOL_DEV_URL,staging:g.VITE_TOPOL_STAGING_URL},m="https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";function h(e="production"){switch(e){case"dev":return r.dev;case"staging":return r.staging;case"production":return r.production;default:return m.replace("{stage}",String(e))}}async function E(e){return new Promise((n,o)=>{d(r.production,i=>{if(i!==null){o(i);return}window.TopolPlugin.init(e),n(!0)})})}const w={init:(e,n)=>new Promise((o,i)=>{const a=h(n==null?void 0:n.stage);d(a,async t=>{if(t!==null){if(a!==r.production)try{return await E(e),o(!0)}catch(s){i(s)}i(t);return}window.TopolPlugin.init(e),o(!0)})}),save:()=>{window.TopolPlugin.save()},load:e=>{window.TopolPlugin.load(e)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:e=>{window.TopolPlugin.chooseFile(e)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},destroy:()=>{window.TopolPlugin.destroy()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},setPreviewHTML:e=>{window.TopolPlugin.setPreviewHTML(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},setActiveMembers:e=>{window.TopolPlugin.setActiveMembers(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},updateCustomBlockContent:e=>{window.TopolPlugin.updateCustomBlockContent(e)},refreshComments:e=>{window.TopolPlugin.refreshComments(e)},refreshSyncedRows:()=>{window.TopolPlugin.refreshSyncedRows()},openPremadeTemplatesSelection:()=>{window.TopolPlugin.openPremadeTemplatesSelection()},updateApiAuthorizationHeader:e=>{window.TopolPlugin.updateApiAuthorizationHeader(e)},setTemplateName:e=>{window.TopolPlugin.setTemplateName(e)},toggleChatAI:()=>{window.TopolPlugin.toggleChatAI()},toggleAutosaves:()=>{window.TopolPlugin.toggleAutosaves()},toggleComments:()=>{window.TopolPlugin.toggleComments()},createLanguage:e=>{window.TopolPlugin.createLanguage(e)},setPrimaryLanguage:e=>{window.TopolPlugin.setPrimaryLanguage(e)},deleteLanguage:e=>{window.TopolPlugin.deleteLanguage(e)},selectLanguage:e=>{window.TopolPlugin.selectLanguage(e)}},v="https://v1.page-assets.topol.io/topol-lpe.js",y={init:(e,n)=>new Promise((o,i)=>{d(v,a=>{if(a!==null){i(a);return}const t=window.LandingPageEditor(e);o(t)})})},p=w;l.EmailEditor=w,l.LandingPageEditor=y,l.TopolPlugin=p,l.default=p,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|