@topol.io/editor 1.0.0-alpha.9 → 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.
Files changed (34) hide show
  1. package/README.md +89 -110
  2. package/dist/topol-plugin.es.js +126 -246
  3. package/dist/topol-plugin.umd.cjs +1 -0
  4. package/dist/types/src/email-editor/constants.d.ts +3 -3
  5. package/dist/types/src/email-editor/index.d.ts +15 -101
  6. package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +1 -1
  7. package/dist/types/src/landing-page-editor/schemas/openAI/openAISchema.d.ts +1 -2
  8. package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +816 -816
  9. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +612 -612
  10. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +816 -816
  11. package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +2 -2
  12. package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +2 -2
  13. package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +6 -6
  14. package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +2 -2
  15. package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +2 -2
  16. package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +92 -92
  17. package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +94 -94
  18. package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +204 -204
  19. package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +804 -804
  20. package/dist/types/src/main.d.ts +9 -72
  21. package/dist/types/types/API/API.d.ts +8 -7
  22. package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +19 -22
  23. package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +64 -155
  24. package/dist/types/types/Cloud/ICloudOptions.d.ts +33 -0
  25. package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
  26. package/dist/types/types/IEmailConfig.d.ts +190 -0
  27. package/dist/types/types/IEmailEditorInstance.d.ts +54 -0
  28. package/dist/types/types/ITopolOptions.d.ts +4 -153
  29. package/dist/types/types/ITopolPlugin.d.ts +2 -44
  30. package/dist/types/types/Language/Language.d.ts +1 -1
  31. package/dist/types/types/SavedBlock/ISavedBlock.d.ts +2 -6
  32. package/dist/types/types/Sections/ISections.d.ts +30 -0
  33. package/package.json +7 -10
  34. package/dist/topol-plugin.umd.js +0 -1
@@ -1,108 +1,22 @@
1
1
  import type ITopolOptions from "../../types/ITopolOptions";
2
- import type ITopolPlugin from "../../types/ITopolPlugin";
3
- import type INotification from "../../types/Notification/INotification";
4
- import type ISavedBlock from "../../types/SavedBlock/ISavedBlock";
5
- import { Stage } from "../../types/Stage";
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
- TopolPlugin: ITopolPlugin;
15
+ TopolEmailEditor: IEmailEditorFactory;
9
16
  }
10
17
  }
11
- export interface EmailEditorPluginOptions {
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 {};
@@ -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 {};