@topol.io/editor 1.0.0-alpha.1 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +153 -101
  2. package/dist/topol-plugin.es.js +146 -191
  3. package/dist/topol-plugin.umd.cjs +1 -0
  4. package/dist/types/src/core/script-loader.d.ts +15 -0
  5. package/dist/types/src/email-editor/constants.d.ts +3 -3
  6. package/dist/types/src/email-editor/index.d.ts +16 -91
  7. package/dist/types/src/landing-page-editor/constants.d.ts +1 -1
  8. package/dist/types/src/landing-page-editor/index.d.ts +27 -10
  9. package/dist/types/src/landing-page-editor/schemas/api/apiSchema.d.ts +5 -10
  10. package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +34 -18
  11. package/dist/types/src/landing-page-editor/schemas/language/languageSchema.d.ts +1 -1
  12. package/dist/types/src/landing-page-editor/schemas/mjmlStore/mjmlStoreSchema.d.ts +8 -6
  13. package/dist/types/src/landing-page-editor/schemas/notification/notificationSchema.d.ts +0 -1
  14. package/dist/types/src/landing-page-editor/schemas/openAI/openAISchema.d.ts +1 -2
  15. package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +153 -17
  16. package/dist/types/src/landing-page-editor/schemas/premadeSection/premadeSectionSchema.d.ts +30 -0
  17. package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +687 -5
  18. package/dist/types/src/landing-page-editor/schemas/template/blocks/carouselBlockSchema.d.ts +9 -2
  19. package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +11 -3
  20. package/dist/types/src/landing-page-editor/schemas/template/blocks/formBlockSchema.d.ts +1069 -0
  21. package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +35 -19
  22. package/dist/types/src/landing-page-editor/schemas/template/blocks/rawBlockSchema.d.ts +9 -1
  23. package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +11 -3
  24. package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +18 -10
  25. package/dist/types/src/landing-page-editor/schemas/template/blocks/textBlockSchema.d.ts +9 -1
  26. package/dist/types/src/landing-page-editor/schemas/template/blocks/videoBlockSchema.d.ts +9 -1
  27. package/dist/types/src/landing-page-editor/schemas/template/commonSchema.d.ts +28 -8
  28. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarCTASchema.d.ts +335 -0
  29. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarHamburgerSchema.d.ts +1109 -0
  30. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarLogoSchema.d.ts +252 -0
  31. package/dist/types/src/landing-page-editor/schemas/template/navbarBlocks/navbarMenuSchema.d.ts +1209 -0
  32. package/dist/types/src/landing-page-editor/schemas/template/settingsSchema.d.ts +4058 -546
  33. package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +5007 -2328
  34. package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +5501 -2412
  35. package/dist/types/src/landing-page-editor/schemas/template/structure/navbarSchema.d.ts +4394 -0
  36. package/dist/types/src/landing-page-editor/schemas/template/structure/rowSchema.d.ts +11094 -0
  37. package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +8602 -3337
  38. package/dist/types/src/landing-page-editor/schemas/template/styleSchema.d.ts +55 -44
  39. package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +34865 -48464
  40. package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4305 -794
  41. package/dist/types/src/landing-page-editor/schemas/theme/themeSchema.d.ts +6 -1
  42. package/dist/types/src/landing-page-editor/schemas/utils/cssValue.d.ts +21 -0
  43. package/dist/types/src/landing-page-editor/schemas/utils/transformBorder.d.ts +10 -5
  44. package/dist/types/src/main.d.ts +28 -101
  45. package/dist/types/types/API/API.d.ts +10 -9
  46. package/dist/types/types/APIBlocks/APIBlocks.d.ts +11 -0
  47. package/dist/types/types/Auth/IAuthorize.d.ts +18 -0
  48. package/dist/types/types/Auth/INonceAuthCallbacks.d.ts +10 -0
  49. package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +28 -18
  50. package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +85 -104
  51. package/dist/types/types/Cloud/ICloudOptions.d.ts +32 -0
  52. package/dist/types/types/ContentBlock/IContentBlockOptions.d.ts +1 -1
  53. package/dist/types/types/Countdown/ICountdownOptions.d.ts +48 -0
  54. package/dist/types/types/IEmailConfig.d.ts +225 -0
  55. package/dist/types/types/IEmailEditorInstance.d.ts +68 -0
  56. package/dist/types/types/IEmailOptions.d.ts +7 -0
  57. package/dist/types/types/Language/Language.d.ts +6 -1
  58. package/dist/types/types/MergeTag/IMergeTag.d.ts +18 -0
  59. package/dist/types/types/Notification/INotification.d.ts +2 -1
  60. package/dist/types/types/Sections/ISections.d.ts +41 -0
  61. package/dist/types/types/Shortcuts/EditorShortcut.d.ts +4 -0
  62. package/dist/types/types/Theme/ITheme.d.ts +12 -2
  63. package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +73 -9
  64. package/dist/types/types/landing-page/ILandingPageOptions.d.ts +110 -62
  65. package/package.json +10 -13
  66. package/dist/topol-plugin.umd.js +0 -1
  67. package/dist/types/src/landing-page-editor/schemas/helpdesk/helpdeskSchema.d.ts +0 -8
  68. package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +0 -59750
  69. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +0 -44831
  70. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +0 -59725
  71. package/dist/types/src/landing-page-editor/schemas/template/blocks/index.d.ts +0 -12
  72. package/dist/types/types/ITopolOptions.d.ts +0 -123
  73. package/dist/types/types/ITopolPlugin.d.ts +0 -37
  74. package/dist/types/types/SavedBlock/ISavedBlock.d.ts +0 -6
@@ -2,27 +2,40 @@ import { type IAuthHeaderConfig } from "../authHeaderConfig/authHeaderConfigSche
2
2
  import { type IAPI } from "../api/apiSchema";
3
3
  import { type IFont } from "../font/fontSchema";
4
4
  import { type ILanguage } from "../language/languageSchema";
5
- import { type ISavedBlocks } from "../savedBlock/savedBlockSchema";
6
5
  import { type ITheme } from "../theme/themeSchema";
7
6
  import { type IContentBlockOptions, type TopolCustomBlockData } from "../contentBlock/contentBlockScheme";
8
- import { type IHelpdesk } from "../helpdesk/helpdeskSchema";
9
7
  import { type IOptionsUser } from "../user/userSchema";
10
8
  import { type TopolTemplateSettings } from "../templateSettings/templateSettingsSchema";
9
+ import { type IOptionsPremadeSection } from "../premadeSection/premadeSectionSchema";
10
+ import type { LandingPageEditorShortcut } from "../../../../types/Shortcuts/EditorShortcut";
11
+ import type { IAuthorize } from "../../../../types/Auth/IAuthorize";
11
12
  import z from "zod";
12
- import { type IOptionsPremadeBlock } from "../premadeBlock/premadeBlockSchema";
13
+ export declare const EditorShortcutSchema: z.ZodEnum<{
14
+ delete: "delete";
15
+ duplicate: "duplicate";
16
+ save: "save";
17
+ saveAndClose: "saveAndClose";
18
+ undo: "undo";
19
+ redo: "redo";
20
+ preview: "preview";
21
+ developerMode: "developerMode";
22
+ copy: "copy";
23
+ escape: "escape";
24
+ addBelow: "addBelow";
25
+ cut: "cut";
26
+ }>;
13
27
  export declare const PluginOptionsSchema: z.ZodTypeAny;
14
28
  export type LambdaStage = "local" | "production" | "stage1" | "stage2" | "stage3";
15
29
  export type UserRole = "manager" | "editor" | "reader";
16
- export interface IPluginOptions {
17
- authorize: {
18
- apiKey: string;
19
- userId: string | number;
20
- };
30
+ /** Options of the Landing Page Editor: the `config` of `LandingPageEditor.init({ config, ...callbacks })`. */
31
+ export interface ILandingPageConfig {
32
+ authorize: IAuthorize;
33
+ aiLabeledElements?: boolean;
21
34
  api?: IAPI;
22
35
  apiAuthorizationHeader?: IAuthHeaderConfig | string;
23
36
  autosaveInterval?: number;
24
- chatAI?: boolean;
25
37
  colors?: string[];
38
+ /** Keyed by block type. Custom blocks are switched off with `customBlocks[].disabled`. */
26
39
  contentBlocks?: IContentBlockOptions;
27
40
  currentUser?: IOptionsUser;
28
41
  customBlocks?: TopolCustomBlockData[];
@@ -34,15 +47,20 @@ export interface IPluginOptions {
34
47
  defaultTemplateSettings?: TopolTemplateSettings;
35
48
  disableAiAssistant?: boolean;
36
49
  disableAlerts?: boolean;
37
- disableExtendedComparators?: boolean;
50
+ /** `true` turns every editor keyboard shortcut off; an array only the listed ones. */
51
+ disableShortcuts?: boolean | LandingPageEditorShortcut[];
38
52
  enableAutosaves?: boolean;
39
53
  enableComments?: boolean;
54
+ enableFileManagerInGif?: boolean;
40
55
  fileManagerPreferences?: {
41
56
  defaultTilesView?: boolean;
57
+ hidePexelsIntegration?: boolean;
58
+ /** Positive integer. */
59
+ maxUploadingFiles?: number;
42
60
  };
43
61
  fontSizes?: number[];
44
- googleApiKey?: string;
45
- helpdesk?: IHelpdesk;
62
+ hideSelectionPanel?: boolean;
63
+ hideSelectionPanelExpand?: boolean;
46
64
  hideSettingsTab?: boolean;
47
65
  hideTopbarControls?: string[];
48
66
  htmlMinified?: boolean;
@@ -52,22 +70,30 @@ export interface IPluginOptions {
52
70
  enableAutoResize?: boolean;
53
71
  enableCompression?: boolean;
54
72
  };
55
- imageEditor?: boolean;
73
+ imageEditorOptions?: {
74
+ hideControls?: string[];
75
+ };
56
76
  imageMaxSize?: number;
57
77
  lambdaStage?: LambdaStage;
58
78
  language?: ILanguage;
59
79
  light?: boolean;
60
- premadeBlocks?: IOptionsPremadeBlock;
80
+ premadeSections?: IOptionsPremadeSection;
61
81
  premadeTemplates?: boolean;
62
82
  premadeTemplatesOptions?: {
63
83
  hideSearch?: boolean;
64
- showDelete?: boolean;
65
84
  };
66
85
  removeTopBar?: boolean;
86
+ /**
87
+ * How Save and Save & Close are laid out when both are visible: `"dropdown"` (default) tucks
88
+ * Save & Close under the Save button's menu, `"separate"` renders two standalone buttons.
89
+ * Ignored when either button is hidden via `hideTopbarControls`.
90
+ */
91
+ saveAndCloseButton?: "dropdown" | "separate";
67
92
  renameTemplate?: boolean;
68
93
  role?: UserRole;
69
- savedBlocks?: ISavedBlocks;
94
+ savedSections?: boolean;
70
95
  showUnsavedDialogBeforeExit?: boolean;
96
+ startWithOpenElementsPanel?: boolean;
71
97
  syncedSectionsEnabled?: boolean;
72
98
  teamUsers?: IOptionsUser[];
73
99
  templateId?: number | string;
@@ -76,6 +102,116 @@ export interface IPluginOptions {
76
102
  title?: string;
77
103
  windowBar?: string[];
78
104
  }
79
- export type IPluginOptionsPartial = Omit<IPluginOptions, "authorize" | "callbacks">;
105
+ export type IPluginOptionsPartial = Omit<ILandingPageConfig, "authorize">;
106
+ /** A file or folder deleted in the built-in file manager (`onImageDelete`). */
107
+ export declare const DeletedItemSchema: z.ZodObject<{
108
+ name: z.ZodString;
109
+ type: z.ZodUnion<readonly [z.ZodLiteral<"file">, z.ZodLiteral<"folder">]>;
110
+ path: z.ZodString;
111
+ url: z.ZodOptional<z.ZodString>;
112
+ key: z.ZodNullable<z.ZodString>;
113
+ }, z.core.$strip>;
114
+ /** Payload of `onSave` and `onSaveAndClose`. */
115
+ export declare const SavePayloadSchema: z.ZodObject<{
116
+ json: z.ZodJSONSchema;
117
+ html: z.ZodString;
118
+ syncedSections: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
119
+ }, z.core.$strip>;
120
+ /**
121
+ * Host callbacks — top-level zoid props of `LandingPageEditor({ config, onSave, ... })`.
122
+ *
123
+ * Convention: every callback receives at most one argument — a payload object with named
124
+ * properties, so payloads can grow without breaking host integrations. Zero-payload
125
+ * callbacks receive nothing.
126
+ *
127
+ * `onEditorClose` / `onEditorError` are named so because zoid reserves `onClose` / `onError`
128
+ * for its own lifecycle (those never reach the child).
129
+ */
130
+ export declare const HostCallbacksSchema: z.ZodObject<{
131
+ onSave: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
132
+ json: z.ZodJSONSchema;
133
+ html: z.ZodString;
134
+ syncedSections: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
135
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
136
+ onSaveAndClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
137
+ json: z.ZodJSONSchema;
138
+ html: z.ZodString;
139
+ syncedSections: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
140
+ }, z.core.$strip>], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
141
+ onOpenFileManager: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
142
+ onImageDelete: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
143
+ items: z.ZodArray<z.ZodObject<{
144
+ name: z.ZodString;
145
+ type: z.ZodUnion<readonly [z.ZodLiteral<"file">, z.ZodLiteral<"folder">]>;
146
+ path: z.ZodString;
147
+ url: z.ZodOptional<z.ZodString>;
148
+ key: z.ZodNullable<z.ZodString>;
149
+ }, z.core.$strip>>;
150
+ }, z.core.$strip>], null>, z.ZodVoid>>;
151
+ onLoaded: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
152
+ onInit: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
153
+ onUndoChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
154
+ count: z.ZodNumber;
155
+ }, z.core.$strip>], null>, z.ZodVoid>>;
156
+ onRedoChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
157
+ count: z.ZodNumber;
158
+ }, z.core.$strip>], null>, z.ZodVoid>>;
159
+ onPreview: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
160
+ html: z.ZodString;
161
+ }, z.core.$strip>], null>, z.ZodVoid>>;
162
+ onPreviewClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodVoid>>;
163
+ onAlert: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
164
+ notification: z.ZodObject<{
165
+ title: z.ZodOptional<z.ZodString>;
166
+ text: z.ZodString;
167
+ expectSideEffect: z.ZodOptional<z.ZodBoolean>;
168
+ persistent: z.ZodOptional<z.ZodBoolean>;
169
+ type: z.ZodEnum<{
170
+ info: "info";
171
+ error: "error";
172
+ success: "success";
173
+ }>;
174
+ id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
175
+ }, z.core.$strip>;
176
+ }, z.core.$strip>], null>, z.ZodVoid>>;
177
+ onEditorClose: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodUnion<readonly [z.ZodVoid, z.ZodPromise<z.ZodVoid>]>>>;
178
+ onUnsavedChangesChange: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
179
+ hasUnsavedChanges: z.ZodBoolean;
180
+ }, z.core.$strip>], null>, z.ZodVoid>>;
181
+ onEdittedWithoutSaveChanged: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
182
+ value: z.ZodBoolean;
183
+ }, z.core.$strip>], null>, z.ZodVoid>>;
184
+ onOpenCustomBlockDialog: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
185
+ block: z.ZodUnknown;
186
+ }, z.core.$strip>], null>, z.ZodVoid>>;
187
+ onTemplateRename: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
188
+ name: z.ZodString;
189
+ }, z.core.$strip>], null>, z.ZodVoid>>;
190
+ onEditorError: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [z.ZodObject<{
191
+ source: z.ZodEnum<{
192
+ save: "save";
193
+ integration: "integration";
194
+ init: "init";
195
+ authorize: "authorize";
196
+ nonceAuth: "nonceAuth";
197
+ network: "network";
198
+ load: "load";
199
+ updateTemplate: "updateTemplate";
200
+ testSend: "testSend";
201
+ cloudTemplates: "cloudTemplates";
202
+ cloudSync: "cloudSync";
203
+ }>;
204
+ message: z.ZodString;
205
+ detail: z.ZodOptional<z.ZodUnknown>;
206
+ }, z.core.$strip>], null>, z.ZodVoid>>;
207
+ }, z.core.$strip>;
208
+ export type IHostCallbacks = z.infer<typeof HostCallbacksSchema>;
209
+ /** Top-level zoid prop of `LandingPageEditor({ config, getNonce, ... })`. */
210
+ export declare const NonceAuthCallbacksSchema: z.ZodObject<{
211
+ getNonce: z.ZodOptional<z.ZodFunction<z.ZodTuple<readonly [], null>, z.ZodPromise<z.ZodString>>>;
212
+ }, z.core.$strip>;
213
+ export type ISavePayload = z.infer<typeof SavePayloadSchema>;
214
+ export type IDeletedItem = z.infer<typeof DeletedItemSchema>;
215
+ /** Everything zoid sets on `window.xprops`: `config`, the host callbacks and zoid's child helpers. */
80
216
  export declare const XpropsSchema: z.ZodTypeAny;
81
217
  export type IXprops = z.infer<typeof XpropsSchema>;
@@ -0,0 +1,30 @@
1
+ import { z } from "zod";
2
+ import { type TopolSection } from "../template/structure/sectionSchema";
3
+ export declare const PremadeSectionSchema: z.ZodTypeAny;
4
+ export declare const PremadeSectionsItemSchema: z.ZodTypeAny;
5
+ export declare const PremadeSectionsSchema: z.ZodTypeAny;
6
+ export declare const LegacyPremadeSectionsSchema: z.ZodTypeAny;
7
+ export declare const PremadeSectionsOverrideSchema: z.ZodTypeAny;
8
+ export declare const OptionsPremadeSectionSchema: z.ZodTypeAny;
9
+ export interface IPremadeSection {
10
+ name?: string;
11
+ img?: string;
12
+ definition: TopolSection[] | TopolSection;
13
+ }
14
+ export interface IPremadeSectionItem {
15
+ id?: number;
16
+ name: string;
17
+ blocks: IPremadeSection[];
18
+ }
19
+ export type IPremadeSections = IPremadeSectionItem[];
20
+ export interface ILegacyPremadeSections {
21
+ content?: IPremadeSection[];
22
+ ecomm?: IPremadeSection[];
23
+ footers?: IPremadeSection[];
24
+ headers?: IPremadeSection[];
25
+ }
26
+ export interface IPremadeSectionsOverride {
27
+ blocks: IPremadeSections | ILegacyPremadeSections;
28
+ override: boolean;
29
+ }
30
+ export type IOptionsPremadeSection = IPremadeSectionsOverride | IPremadeSections | ILegacyPremadeSections | false;