@topol.io/editor 1.0.0-alpha.8 → 2.0.0-alpha.1
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 +89 -110
- package/dist/topol-plugin.es.js +122 -249
- package/dist/topol-plugin.umd.cjs +1 -0
- package/dist/types/src/email-editor/constants.d.ts +3 -3
- package/dist/types/src/email-editor/index.d.ts +15 -101
- package/dist/types/src/landing-page-editor/index.d.ts +1 -1
- 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 +11 -74
- package/dist/types/types/API/API.d.ts +8 -7
- package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +19 -22
- package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +64 -155
- package/dist/types/types/Cloud/ICloudOptions.d.ts +33 -0
- package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
- package/dist/types/types/IEmailConfig.d.ts +190 -0
- package/dist/types/types/IEmailEditorInstance.d.ts +54 -0
- package/dist/types/types/ITopolOptions.d.ts +4 -153
- package/dist/types/types/ITopolPlugin.d.ts +2 -44
- package/dist/types/types/Language/Language.d.ts +1 -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/ILandingPageOptions.d.ts +96 -63
- package/package.json +7 -10
- package/dist/topol-plugin.umd.js +0 -1
|
@@ -1,108 +1,22 @@
|
|
|
1
1
|
import type ITopolOptions from "../../types/ITopolOptions";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type IEmailEditorInstance from "../../types/IEmailEditorInstance";
|
|
3
|
+
import type { Stage } from "../../types/Stage";
|
|
4
|
+
export interface IEmailEditorPluginOptions {
|
|
5
|
+
stage?: Stage;
|
|
6
|
+
/** Explicit v4 loader URL, e.g. a deployed preview or local build. One URL per page; never falls back on failure. */
|
|
7
|
+
loaderUrl?: string;
|
|
8
|
+
}
|
|
9
|
+
type IRawEmailEditorInstance = Omit<IEmailEditorInstance, "destroy"> & {
|
|
10
|
+
close(): Promise<void>;
|
|
11
|
+
};
|
|
12
|
+
type IEmailEditorFactory = (options: ITopolOptions) => IRawEmailEditorInstance;
|
|
6
13
|
declare global {
|
|
7
14
|
interface Window {
|
|
8
|
-
|
|
15
|
+
TopolEmailEditor: IEmailEditorFactory;
|
|
9
16
|
}
|
|
10
17
|
}
|
|
11
|
-
|
|
12
|
-
stage?: Stage;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Email Editor - Create rich email templates with drag-and-drop editing.
|
|
16
|
-
*
|
|
17
|
-
* This is the main Email Editor integration that loads the Topol Email Editor
|
|
18
|
-
* into your application.
|
|
19
|
-
*
|
|
20
|
-
* @example
|
|
21
|
-
* ```typescript
|
|
22
|
-
* import { EmailEditor } from '@topol.io/editor';
|
|
23
|
-
*
|
|
24
|
-
* await EmailEditor.init({
|
|
25
|
-
* id: '#editor',
|
|
26
|
-
* authorize: { apiKey: 'your-key', userId: 'user-123' },
|
|
27
|
-
* callbacks: {
|
|
28
|
-
* onSave(json, html) { console.log('Saved:', json); }
|
|
29
|
-
* }
|
|
30
|
-
* });
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
18
|
+
/** Editor v4. init creates an instance; render mounts it; onInit reports successful editor authentication. */
|
|
33
19
|
export declare const EmailEditor: {
|
|
34
|
-
|
|
35
|
-
* Initialize the Email Editor.
|
|
36
|
-
* @param topolOptions - Configuration options for the editor
|
|
37
|
-
* @param options - Plugin options including stage selection
|
|
38
|
-
* @returns Promise that resolves to true when the editor is ready
|
|
39
|
-
*/
|
|
40
|
-
init: (topolOptions: ITopolOptions, options?: EmailEditorPluginOptions) => Promise<boolean | string>;
|
|
41
|
-
/** Trigger the save callback with current editor content */
|
|
42
|
-
save: (lang?: string) => void;
|
|
43
|
-
/** Load a template JSON into the editor */
|
|
44
|
-
load: (json: unknown) => void;
|
|
45
|
-
/** Toggle the preview mode */
|
|
46
|
-
togglePreview: () => void;
|
|
47
|
-
/** Toggle between desktop and mobile preview sizes */
|
|
48
|
-
togglePreviewSize: () => void;
|
|
49
|
-
/** Select a file from the custom file manager */
|
|
50
|
-
chooseFile: (url: string) => void;
|
|
51
|
-
/** Undo the last action */
|
|
52
|
-
undo: () => void;
|
|
53
|
-
/** Redo the last undone action */
|
|
54
|
-
redo: () => void;
|
|
55
|
-
/** Destroy the editor instance and clean up resources */
|
|
56
|
-
destroy: () => void;
|
|
57
|
-
/** Update the list of saved/reusable blocks */
|
|
58
|
-
setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
|
|
59
|
-
/** Set custom HTML for the preview */
|
|
60
|
-
setPreviewHTML: (html: unknown) => void;
|
|
61
|
-
/** Display a notification in the editor */
|
|
62
|
-
createNotification: (notification: INotification) => void;
|
|
63
|
-
/** Set the list of active collaboration members */
|
|
64
|
-
setActiveMembers: (activeMembers: string[]) => void;
|
|
65
|
-
/** Switch to mobile view */
|
|
66
|
-
changeEmailToMobile: () => void;
|
|
67
|
-
/** Switch to desktop view */
|
|
68
|
-
changeEmailToDesktop: () => void;
|
|
69
|
-
/** Toggle visibility of hidden blocks and structures */
|
|
70
|
-
toggleBlocksAndStructuresVisibility: () => void;
|
|
71
|
-
/** Update the content of a custom block */
|
|
72
|
-
updateCustomBlockContent: (content: string) => void;
|
|
73
|
-
/** Refresh comments/conversations */
|
|
74
|
-
refreshComments: (key: string) => void;
|
|
75
|
-
/** Refresh synced rows */
|
|
76
|
-
refreshSyncedRows: () => void;
|
|
77
|
-
/** Open the premade templates selection modal */
|
|
78
|
-
openPremadeTemplatesSelection: () => void;
|
|
79
|
-
/** Update the API authorization header */
|
|
80
|
-
updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
|
|
81
|
-
/** Set the template name/title */
|
|
82
|
-
setTemplateName: (name: string) => void;
|
|
83
|
-
updateOptions: (options: Partial<ITopolOptions>) => void;
|
|
84
|
-
/** Toggle the AI chat feature */
|
|
85
|
-
toggleChatAI: () => void;
|
|
86
|
-
/** Toggle the autosaves feature */
|
|
87
|
-
toggleAutosaves: () => void;
|
|
88
|
-
/** Toggle the comments panel */
|
|
89
|
-
toggleComments: () => void;
|
|
90
|
-
/** Create a new language variant */
|
|
91
|
-
createLanguage: (lang: string) => void;
|
|
92
|
-
/** Set the primary language */
|
|
93
|
-
setPrimaryLanguage: (lang: string) => void;
|
|
94
|
-
/** Delete a language variant */
|
|
95
|
-
deleteLanguage: (lang: string) => void;
|
|
96
|
-
/** Select/switch to a language */
|
|
97
|
-
selectLanguage: (lang: string) => void;
|
|
98
|
-
/** Get the list of mutations */
|
|
99
|
-
getMutations: () => void;
|
|
100
|
-
/** Toggle the control panel visibility */
|
|
101
|
-
toggleControlPanel: () => void;
|
|
102
|
-
/** Update the editor template with new JSON data */
|
|
103
|
-
updateTemplate: (json: unknown, options?: {
|
|
104
|
-
skipSnapshot?: boolean;
|
|
105
|
-
}) => void;
|
|
106
|
-
/** Toggle dark mode for the editor */
|
|
107
|
-
toggleDarkMode: () => void;
|
|
20
|
+
init(options: ITopolOptions, pluginOptions?: IEmailEditorPluginOptions): Promise<IEmailEditorInstance>;
|
|
108
21
|
};
|
|
22
|
+
export {};
|
|
@@ -40,7 +40,7 @@ export interface LandingPageEditorPluginOptions {
|
|
|
40
40
|
* config: {
|
|
41
41
|
* authorize: { apiKey: 'your-key', userId: 'user-123' },
|
|
42
42
|
* },
|
|
43
|
-
* onSave(json, html) { console.log('Saved:', json, html); },
|
|
43
|
+
* onSave({ json, html }) { console.log('Saved:', json, html); },
|
|
44
44
|
* onLoaded() { console.log('Template loaded'); }
|
|
45
45
|
* });
|
|
46
46
|
*
|
|
@@ -228,9 +228,9 @@ export declare const ButtonStyleAttributesSchema: z.ZodRecord<z.ZodUnion<[z.ZodE
|
|
|
228
228
|
validatorErrorMessage: z.ZodOptional<z.ZodString>;
|
|
229
229
|
}, z.core.$strip>, z.ZodAny]>>;
|
|
230
230
|
export declare const ImageAttributesSchema: z.ZodRecord<z.ZodUnion<[z.ZodEnum<{
|
|
231
|
+
title: "title";
|
|
231
232
|
src: "src";
|
|
232
233
|
transform: "transform";
|
|
233
|
-
title: "title";
|
|
234
234
|
filter: "filter";
|
|
235
235
|
display: "display";
|
|
236
236
|
width: "width";
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
declare const OpenAIMessageSchema: z.ZodObject<{
|
|
2
|
+
export declare const OpenAIMessageSchema: z.ZodObject<{
|
|
3
3
|
role: z.ZodString;
|
|
4
4
|
content: z.ZodString;
|
|
5
5
|
}, z.core.$strip>;
|
|
6
6
|
export type IOpenAIMessage = z.infer<typeof OpenAIMessageSchema>;
|
|
7
|
-
export {};
|
|
@@ -77,5 +77,94 @@ export interface IPluginOptions {
|
|
|
77
77
|
windowBar?: string[];
|
|
78
78
|
}
|
|
79
79
|
export type IPluginOptionsPartial = Omit<IPluginOptions, "authorize" | "callbacks">;
|
|
80
|
+
/** A file or folder deleted in the built-in file manager (`onImageDelete`). */
|
|
81
|
+
export declare const DeletedItemSchema: z.ZodObject<{
|
|
82
|
+
name: z.ZodString;
|
|
83
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"file">, z.ZodLiteral<"folder">]>;
|
|
84
|
+
path: z.ZodString;
|
|
85
|
+
url: z.ZodOptional<z.ZodString>;
|
|
86
|
+
key: z.ZodNullable<z.ZodString>;
|
|
87
|
+
}, z.core.$strip>;
|
|
88
|
+
/** Payload of `onSave` and `onSaveAndClose`. */
|
|
89
|
+
export declare const SavePayloadSchema: z.ZodObject<{
|
|
90
|
+
json: z.ZodJSONSchema;
|
|
91
|
+
html: z.ZodString;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
/**
|
|
94
|
+
* Host callbacks — top-level zoid props of `LandingPageEditor({ config, onSave, ... })`.
|
|
95
|
+
*
|
|
96
|
+
* Convention: every callback receives at most one argument — a payload object with named
|
|
97
|
+
* properties, so payloads can grow without breaking host integrations. Zero-payload
|
|
98
|
+
* callbacks receive nothing.
|
|
99
|
+
*
|
|
100
|
+
* `onEditorClose` / `onEditorError` are named so because zoid reserves `onClose` / `onError`
|
|
101
|
+
* for its own lifecycle (those never reach the child).
|
|
102
|
+
*/
|
|
103
|
+
export declare const HostCallbacksSchema: z.ZodObject<{
|
|
104
|
+
onSave: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
105
|
+
json: z.ZodJSONSchema;
|
|
106
|
+
html: z.ZodString;
|
|
107
|
+
}, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
108
|
+
onSaveAndClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
109
|
+
json: z.ZodJSONSchema;
|
|
110
|
+
html: z.ZodString;
|
|
111
|
+
}, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
112
|
+
onOpenFileManager: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
|
|
113
|
+
onImageDelete: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
114
|
+
items: z.ZodArray<z.ZodObject<{
|
|
115
|
+
name: z.ZodString;
|
|
116
|
+
type: z.ZodUnion<readonly [z.ZodLiteral<"file">, z.ZodLiteral<"folder">]>;
|
|
117
|
+
path: z.ZodString;
|
|
118
|
+
url: z.ZodOptional<z.ZodString>;
|
|
119
|
+
key: z.ZodNullable<z.ZodString>;
|
|
120
|
+
}, z.core.$strip>>;
|
|
121
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
122
|
+
onLoaded: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
|
|
123
|
+
onInit: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
|
|
124
|
+
onUndoChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
125
|
+
count: z.ZodNumber;
|
|
126
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
127
|
+
onRedoChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
128
|
+
count: z.ZodNumber;
|
|
129
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
130
|
+
onPreview: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
131
|
+
html: z.ZodString;
|
|
132
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
133
|
+
onPreviewClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
|
|
134
|
+
onAlert: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
135
|
+
notification: z.ZodObject<{
|
|
136
|
+
title: z.ZodOptional<z.ZodString>;
|
|
137
|
+
text: z.ZodString;
|
|
138
|
+
expectSideEffect: z.ZodOptional<z.ZodBoolean>;
|
|
139
|
+
persistent: z.ZodOptional<z.ZodBoolean>;
|
|
140
|
+
type: z.ZodEnum<{
|
|
141
|
+
info: "info";
|
|
142
|
+
error: "error";
|
|
143
|
+
success: "success";
|
|
144
|
+
}>;
|
|
145
|
+
extarnalUse: z.ZodOptional<z.ZodBoolean>;
|
|
146
|
+
id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
147
|
+
}, z.core.$strip>;
|
|
148
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
149
|
+
onEditorClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
|
|
150
|
+
onEdittedWithoutSaveChanged: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
151
|
+
value: z.ZodBoolean;
|
|
152
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
153
|
+
onOpenCustomBlockDialog: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
154
|
+
block: z.ZodUnknown;
|
|
155
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
156
|
+
onTemplateRename: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
157
|
+
name: z.ZodString;
|
|
158
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
159
|
+
onEditorError: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
|
|
160
|
+
source: z.ZodString;
|
|
161
|
+
message: z.ZodString;
|
|
162
|
+
detail: z.ZodOptional<z.ZodUnknown>;
|
|
163
|
+
}, z.core.$strip>], null>, z.ZodVoid>>;
|
|
164
|
+
}, z.core.$strip>;
|
|
165
|
+
export type IHostCallbacks = z.infer<typeof HostCallbacksSchema>;
|
|
166
|
+
export type ISavePayload = z.infer<typeof SavePayloadSchema>;
|
|
167
|
+
export type IDeletedItem = z.infer<typeof DeletedItemSchema>;
|
|
168
|
+
/** Everything zoid sets on `window.xprops`: `config`, the host callbacks and zoid's child helpers. */
|
|
80
169
|
export declare const XpropsSchema: z.ZodTypeAny;
|
|
81
170
|
export type IXprops = z.infer<typeof XpropsSchema>;
|