@topol.io/editor 0.0.4 → 0.1.0

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 CHANGED
@@ -30,7 +30,7 @@ Add HTML element Editor will load to
30
30
 
31
31
  In your JS or TS file import TopolPlugin, initialize the editor, as an ID provide the id you defined the HTML, in this example its `app`
32
32
 
33
- For more options see the docs for [TopolOptions configuration](https://topol.io/docs#plugin-configuration)
33
+ For more options see the docs for [TopolOptions configuration](https://docs.topol.io/reference/topol-options.html)
34
34
 
35
35
  ```js
36
36
  import TopolPlugin from "@topol.io/editor";
@@ -61,22 +61,54 @@ TopolPlugin.save();
61
61
 
62
62
  ### List of all available TopolPlugin actions:
63
63
 
64
- | Action | Description |
65
- | ------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
66
- | `TopolPlugin.save()` | Saves the content of the editor [more info](https://topol.io/docs#plugin-configuration) |
67
- | `TopolPlugin.load(template`) | Loads the provided template [more info](https://topol.io/docs#save-and-load-options) |
68
- | `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://topol.io/docs#preview-mode-on-desktop-and-mobile) |
69
- | `TopolPlugin.togglePreviewSize()` | Toggles editor preview size |
70
- | `TopolPlugin.undo()` | Undo change in editor [more info](https://topol.io/docs#redo-and-undo) |
71
- | `TopolPlugin.redo()` | Redo change in editor [more info](https://topol.io/docs#redo-and-undo) |
72
- | `TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[])` | Sets the saved blocks [more info](https://topol.io/docs#saved-blocks) |
73
- | `TopolPlugin.createNotification(notification: INotification)` | Creates editor's notification [more info](https://topol.io/docs#show-custom-notification-in-editor) |
74
- | `TopolPlugin.changeEmailToMobile()` | Change email to mobile view [more info](https://topol.io/docs#mobile-first-email-template) |
75
- | `TopolPlugin.changeEmailToDesktop()` | Change email to desktop view [more info](https://topol.io/docs#mobile-first-email-template) |
76
- | `TopolPlugin.toggleBlocksAndStructuresVisibility()` | Toggle hidden structures visibility for blocks and structures [more info](https://topol.io/docs#mobile-first-email-template) |
77
- | `TopolPlugin.destroy()` | Destroys the editor initialization [more info](https://topol.io/docs#working-with-js-frameworks) |
64
+ | Action | Description |
65
+ | --------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
66
+ | `TopolPlugin.save()` | Saves the content of the editor [more info](https://docs.topol.io/guide/how-to-use-custom-topbar.html#save-and-saveandclose) |
67
+ | `TopolPlugin.load(template)` | Loads the provided template [more info](https://docs.topol.io/guide/how-to-load-and-save-template.html#loading-template) |
68
+ | `TopolPlugin.togglePreview()` | Toggles editor preview [more info](https://docs.topol.io/guide/how-to-use-custom-topbar.html#changing-preview-mode) |
69
+ | `TopolPlugin.togglePreviewSize()` | Toggles editor preview size [more info](https://docs.topol.io/guide/how-to-use-custom-topbar.html#changing-preview-mode) |
70
+ | `TopolPlugin.undo()` | Undo change in editor [more info](https://docs.topol.io/guide/how-to-use-custom-topbar.html#undo-and-redo) |
71
+ | `TopolPlugin.redo()` | Redo change in editor [more info](https://docs.topol.io/guide/how-to-use-custom-topbar.html#undo-and-redo) |
72
+ | `TopolPlugin.setSavedBlocks(savedblock: ISavedBlock[])` | Sets the saved blocks [more info](https://docs.topol.io/guide/saved-blocks.html) |
73
+ | `TopolPlugin.createNotification(notification: INotification)` | Creates editor's notification [more info](https://docs.topol.io/guide/custom-notifications.html) |
74
+ | `TopolPlugin.changeEmailToMobile()` | Change email to mobile view [more info](https://docs.topol.io/guide/mobile-first.html#mobile-first-email-template) |
75
+ | `TopolPlugin.changeEmailToDesktop()` | Change email to desktop view [more info](https://docs.topol.io/guide/mobile-first.html#mobile-first-email-template) |
76
+ | `TopolPlugin.toggleBlocksAndStructuresVisibility()` | Toggle hidden structures visibility for blocks and structures [more info](https://docs.topol.io/guide/mobile-first.html#mobile-first-email-template) |
77
+ | `TopolPlugin.destroy()` | Destroys the editor initialization |
78
+ | `TopolPlugin.chooseFile()` | Chooses the file if image block is active [more info](https://docs.topol.io/guide/custom-filemanager.html#choosefile) |
79
+ | `TopolPlugin.openPremadeTemplatesSelection()` | Opens the premade templates modal pick [more info](https://docs.topol.io/guide/premade-templates-in-editor.html) |
80
+ | `TopolPlugin.refreshComments(key: string)` | Refreshes the conversation [more info](https://docs.topol.io/guide/comments.html#refreshcomments) |
81
+ | `TopolPlugin.setActiveMembers(activeMemers: string[])` | Sets the active members |
82
+ | `TopolPlugin.setTemplateName(name: string)` | Sets the name of template [more info](https://docs.topol.io/guide/rename-template.html) |
83
+ | `TopolPlugin.updateApiAuthorizationHeader(newHeader: string \| Record<string, string>)` | Refreshes the authorization tokens [more info](https://docs.topol.io/guide/security.html#refresh-token) |
84
+ | `TopolPlugin.updateCustomBlockContent(content: string)` | Refreshes the authorization tokens [more info](https://docs.topol.io/guide/custom-block.html#inserting-custom-html-in-custom-dialog-component) |
78
85
 
79
86
  <br>
87
+
88
+ ### List of all editor events
89
+
90
+ | Event | Description |
91
+ | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
92
+ | `@onSave` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save) |
93
+ | `@onSaveAndClose` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save-and-close) |
94
+ | `@onTestSend` | Returns object which contains email, html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-test-email-send) |
95
+ | `@onOpenFileManager` | When user clicks file manager open [more info](https://docs.topol.io/guide/custom-filemanager.html#onopenfilemanager) |
96
+ | `@onLoaded` | After editor template is loaded using `TopolPlugin.load()` [more info](https://docs.topol.io/guide/callbacks.html#on-loaded) |
97
+ | `@onInit` | When editor inits [more info](https://docs.topol.io/guide/callbacks.html#on-init) |
98
+ | `@onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://docs.topol.io/guide/callbacks.html#on-block-save) |
99
+ | `@onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://docs.topol.io/guide/callbacks.html#on-block-remove) |
100
+ | `@onBlockEdit` | When user edits saved block, returns id of saved block to be updated [more info](https://docs.topol.io/guide/callbacks.html#on-block-edit) |
101
+ | `@onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://docs.topol.io/guide/callbacks.html#on-undo-change) |
102
+ | `@onRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://docs.topol.io/guide/callbacks.html#on-redo-change) |
103
+ | `@onPreview` | When user switches to preview [more info](https://docs.topol.io/guide/callbacks.html#on-preview) |
104
+ | `@onAlert` | When alert appears in editor [more info](https://docs.topol.io/guide/callbacks.html#on-alert) |
105
+ | `@onClose` | When close is click inside WindowBar [more info](https://docs.topol.io/guide/top-bar.html#window-bar) |
106
+ | `@onEdittedWithoutSaveChanged` | When user is about to leave an editor with unsaved changes [more info](https://docs.topol.io/guide/disable-before-leaving-modal.html#before-exit-modal-when-user-has-unsaved-changes) |
107
+ | `@onOpenCustomBlockDialog` | When user clicks on the open dialog in custom block [more info](https://docs.topol.io/guide/custom-block.html#inserting-custom-html-in-custom-dialog-component) |
108
+ | `@onTemplateRename` | When user clicks on the pencil icon next to the template name [more info](https://docs.topol.io/guide/rename-template.html#rename-template) |
109
+ | `@updateTestingEmailAddresses` | When user edits the email list in preview [more info](https://docs.topol.io/guide/sending-a-test-email.html#managing-saving-emails-yourself) |
110
+ | `@onError` | When an error that cannot be handled happened in the editor [more info](https://docs.topol.io/guide/callbacks.html#onerror) |
111
+
80
112
  <br>
81
113
 
82
114
  ## TypeScript
@@ -1,52 +1,52 @@
1
- function r(o) {
2
- return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
1
+ function r(e) {
2
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var u = function(n, e, l) {
5
- var i = document.head || document.getElementsByTagName("head")[0], t = document.createElement("script");
6
- typeof e == "function" && (l = e, e = {}), e = e || {}, l = l || function() {
7
- }, t.type = e.type || "text/javascript", t.charset = e.charset || "utf8", t.async = "async" in e ? !!e.async : !0, t.src = n, e.attrs && c(t, e.attrs), e.text && (t.text = "" + e.text);
8
- var d = "onload" in t ? a : s;
9
- d(t, l), t.onload || a(t, l), i.appendChild(t);
4
+ var u = function(t, o, i) {
5
+ var l = document.head || document.getElementsByTagName("head")[0], n = document.createElement("script");
6
+ typeof o == "function" && (i = o, o = {}), o = o || {}, i = i || function() {
7
+ }, n.type = o.type || "text/javascript", n.charset = o.charset || "utf8", n.async = "async" in o ? !!o.async : !0, n.src = t, o.attrs && s(n, o.attrs), o.text && (n.text = "" + o.text);
8
+ var d = "onload" in n ? a : c;
9
+ d(n, i), n.onload || a(n, i), l.appendChild(n);
10
10
  };
11
- function c(o, n) {
12
- for (var e in n)
13
- o.setAttribute(e, n[e]);
11
+ function s(e, t) {
12
+ for (var o in t)
13
+ e.setAttribute(o, t[o]);
14
14
  }
15
- function a(o, n) {
16
- o.onload = function() {
17
- this.onerror = this.onload = null, n(null, o);
18
- }, o.onerror = function() {
19
- this.onerror = this.onload = null, n(new Error("Failed to load " + this.src), o);
15
+ function a(e, t) {
16
+ e.onload = function() {
17
+ this.onerror = this.onload = null, t(null, e);
18
+ }, e.onerror = function() {
19
+ this.onerror = this.onload = null, t(new Error("Failed to load " + this.src), e);
20
20
  };
21
21
  }
22
- function s(o, n) {
23
- o.onreadystatechange = function() {
24
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, o));
22
+ function c(e, t) {
23
+ e.onreadystatechange = function() {
24
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, t(null, e));
25
25
  };
26
26
  }
27
- const g = /* @__PURE__ */ r(u), w = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", f = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", T = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
- function P(o = "production") {
29
- switch (o) {
27
+ const w = /* @__PURE__ */ r(u), g = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", p = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", T = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
28
+ function P(e = "production") {
29
+ switch (e) {
30
30
  case "dev":
31
- return f;
31
+ return p;
32
32
  case "staging":
33
33
  return T;
34
34
  default:
35
- return w;
35
+ return g;
36
36
  }
37
37
  }
38
- const p = {
39
- init: (o, n) => new Promise((e, l) => {
40
- const i = P(n == null ? void 0 : n.stage);
41
- g(i, (t) => {
42
- t !== null && l(t), window.TopolPlugin.init(o), e(!0);
38
+ const f = {
39
+ init: (e, t) => new Promise((o, i) => {
40
+ const l = P(t == null ? void 0 : t.stage);
41
+ w(l, (n) => {
42
+ n !== null && i(n), window.TopolPlugin.init(e), o(!0);
43
43
  });
44
44
  }),
45
45
  save: () => {
46
46
  window.TopolPlugin.save();
47
47
  },
48
- load: (o) => {
49
- window.TopolPlugin.load(o);
48
+ load: (e) => {
49
+ window.TopolPlugin.load(e);
50
50
  },
51
51
  togglePreview: () => {
52
52
  window.TopolPlugin.togglePreview();
@@ -54,8 +54,8 @@ const p = {
54
54
  togglePreviewSize: () => {
55
55
  window.TopolPlugin.togglePreviewSize();
56
56
  },
57
- chooseFile: (o) => {
58
- window.TopolPlugin.chooseFile(o);
57
+ chooseFile: (e) => {
58
+ window.TopolPlugin.chooseFile(e);
59
59
  },
60
60
  undo: () => {
61
61
  window.TopolPlugin.undo();
@@ -63,11 +63,20 @@ const p = {
63
63
  redo: () => {
64
64
  window.TopolPlugin.redo();
65
65
  },
66
- setSavedBlocks: (o) => {
67
- window.TopolPlugin.setSavedBlocks(o);
66
+ destroy: () => {
67
+ window.TopolPlugin.destroy();
68
+ },
69
+ setSavedBlocks: (e) => {
70
+ window.TopolPlugin.setSavedBlocks(e);
71
+ },
72
+ setPreviewHTML: (e) => {
73
+ window.TopolPlugin.setPreviewHTML(e);
74
+ },
75
+ createNotification: (e) => {
76
+ window.TopolPlugin.createNotification(e);
68
77
  },
69
- createNotification: (o) => {
70
- window.TopolPlugin.createNotification(o);
78
+ setActiveMembers: (e) => {
79
+ window.TopolPlugin.setActiveMembers(e);
71
80
  },
72
81
  changeEmailToMobile: () => {
73
82
  window.TopolPlugin.changeEmailToMobile();
@@ -78,19 +87,25 @@ const p = {
78
87
  toggleBlocksAndStructuresVisibility: () => {
79
88
  window.TopolPlugin.toggleBlocksAndStructuresVisibility();
80
89
  },
81
- destroy: () => {
82
- window.TopolPlugin.destroy();
90
+ updateCustomBlockContent: (e) => {
91
+ window.TopolPlugin.updateCustomBlockContent(e);
92
+ },
93
+ refreshComments: (e) => {
94
+ window.TopolPlugin.refreshComments(e);
95
+ },
96
+ refreshSyncedRows: () => {
97
+ window.TopolPlugin.refreshSyncedRows();
83
98
  },
84
- setPreviewHTML: (o) => {
85
- window.TopolPlugin.setPreviewHTML(o);
99
+ openPremadeTemplatesSelection: () => {
100
+ window.TopolPlugin.openPremadeTemplatesSelection();
86
101
  },
87
- setActiveMembers: (o) => {
88
- window.TopolPlugin.setActiveMembers(o);
102
+ updateApiAuthorizationHeader: (e) => {
103
+ window.TopolPlugin.updateApiAuthorizationHeader(e);
89
104
  },
90
- updateCustomBlockContent: (o) => {
91
- window.TopolPlugin.updateCustomBlockContent(o);
105
+ setTemplateName: (e) => {
106
+ window.TopolPlugin.setTemplateName(e);
92
107
  }
93
108
  };
94
109
  export {
95
- p as default
110
+ f as default
96
111
  };
@@ -1 +1 @@
1
- (function(l,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(l=typeof globalThis<"u"?globalThis:l||self,l["topol-plugin"]=d())})(this,function(){"use strict";function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(t,o,i){var u=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof o=="function"&&(i=o,o={}),o=o||{},i=i||function(){},n.type=o.type||"text/javascript",n.charset=o.charset||"utf8",n.async="async"in o?!!o.async:!0,n.src=t,o.attrs&&a(n,o.attrs),o.text&&(n.text=""+o.text);var T="onload"in n?r:c;T(n,i),n.onload||r(n,i),u.appendChild(n)};function a(e,t){for(var o in t)e.setAttribute(o,t[o])}function r(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function c(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const s=l(d),g="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",w="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",f="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function p(e="production"){switch(e){case"dev":return w;case"staging":return f;default:return g}}return{init:(e,t)=>new Promise((o,i)=>{const u=p(t==null?void 0:t.stage);s(u,n=>{n!==null&&i(n),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()},setSavedBlocks:e=>{window.TopolPlugin.setSavedBlocks(e)},createNotification:e=>{window.TopolPlugin.createNotification(e)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},destroy:()=>{window.TopolPlugin.destroy()},setPreviewHTML:e=>{window.TopolPlugin.setPreviewHTML(e)},setActiveMembers:e=>{window.TopolPlugin.setActiveMembers(e)},updateCustomBlockContent:e=>{window.TopolPlugin.updateCustomBlockContent(e)}}});
1
+ (function(l,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(l=typeof globalThis<"u"?globalThis:l||self,l["topol-plugin"]=d())})(this,function(){"use strict";function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var d=function(t,o,i){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof o=="function"&&(i=o,o={}),o=o||{},i=i||function(){},n.type=o.type||"text/javascript",n.charset=o.charset||"utf8",n.async="async"in o?!!o.async:!0,n.src=t,o.attrs&&u(n,o.attrs),o.text&&(n.text=""+o.text);var T="onload"in n?a:s;T(n,i),n.onload||a(n,i),r.appendChild(n)};function u(e,t){for(var o in t)e.setAttribute(o,t[o])}function a(e,t){e.onload=function(){this.onerror=this.onload=null,t(null,e)},e.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),e)}}function s(e,t){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,e))}}const c=l(d),g="https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js",w="https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js",p="https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";function f(e="production"){switch(e){case"dev":return w;case"staging":return p;default:return g}}return{init:(e,t)=>new Promise((o,i)=>{const r=f(t==null?void 0:t.stage);c(r,n=>{n!==null&&i(n),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)}}});
@@ -28,15 +28,20 @@ declare const TopolPlugin: {
28
28
  chooseFile: (url: string) => void;
29
29
  undo: () => void;
30
30
  redo: () => void;
31
+ destroy: () => void;
31
32
  setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
33
+ setPreviewHTML: (html: unknown) => void;
32
34
  createNotification: (notification: INotification) => void;
35
+ setActiveMembers: (activeMemers: string[]) => void;
33
36
  changeEmailToMobile: () => void;
34
37
  changeEmailToDesktop: () => void;
35
38
  toggleBlocksAndStructuresVisibility: () => void;
36
- destroy: () => void;
37
- setPreviewHTML: (html: unknown) => void;
38
- setActiveMembers: (activeMemers: string[]) => void;
39
39
  updateCustomBlockContent: (content: string) => void;
40
+ refreshComments: (key: string) => void;
41
+ refreshSyncedRows: () => void;
42
+ openPremadeTemplatesSelection: () => void;
43
+ updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
44
+ setTemplateName: (name: string) => void;
40
45
  };
41
46
  export default TopolPlugin;
42
47
  export type { ITopolOptions, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
@@ -1,14 +1,18 @@
1
1
  export default interface IAPI {
2
- GET_AUTOSAVE?: string;
2
+ AUTOSAVE?: string;
3
3
  AUTOSAVES?: string;
4
+ GET_AUTOSAVE?: string;
5
+ CONVERSATIONS?: string;
6
+ COMMENTS?: string;
7
+ IMAGE_UPLOAD?: string;
8
+ IMAGE_EDITOR_UPLOAD?: string;
9
+ FOLDERS?: string;
4
10
  LOAD?: string;
5
- SAVE?: string;
6
- AUTOSAVE?: string;
7
11
  PREVIEW?: string;
8
- FEEDS?: string;
9
12
  PRODUCTS?: string;
10
- IMAGE_UPLOAD?: string;
11
- FOLDERS?: string;
12
- IMAGE_EDITOR_UPLOAD?: string;
13
+ FEEDS?: string;
14
+ SAVE?: string;
15
+ SYNCED_ROWS?: string;
16
+ SAVED_BLOCKS?: string;
13
17
  TEST_EMAIL?: string;
14
18
  }
@@ -0,0 +1,12 @@
1
+ export default interface IAPIBlockProperties {
2
+ pluralName: string;
3
+ icon: string;
4
+ blockStructure: any;
5
+ apiStructure?: any;
6
+ itemsURL?: string;
7
+ feedsURL?: string;
8
+ apiWithoutSearch?: boolean;
9
+ nextKey?: boolean;
10
+ beta?: boolean;
11
+ disabled?: boolean;
12
+ }
@@ -1,8 +1,9 @@
1
- type BlockType = "text" | "image" | "gif" | "button" | "divider" | "spacer" | "social" | "video" | "html" | "product";
1
+ type BlockType = "text" | "image" | "gif" | "button" | "divider" | "spacer" | "social" | "video" | "html" | "product" | "dynamic" | "article" | "carousel" | "raw" | "custom-raw" | "apiBlock";
2
2
  export type IContentBlockOption = {
3
3
  disabled?: boolean;
4
4
  disabledText?: string;
5
5
  hidden?: boolean;
6
+ disabledBadge?: string;
6
7
  };
7
8
  export type IContentBlockOptions = {
8
9
  [TKey in BlockType]?: IContentBlockOption;
@@ -6,12 +6,21 @@ export type IContentBlockOptionsType = {
6
6
  export type ICustomBlockData = {
7
7
  key: string;
8
8
  name: string;
9
- dialog: true;
9
+ dialog?: true;
10
10
  icon?: "box" | "rss" | string;
11
11
  content?: string;
12
12
  dialogButtonText?: string;
13
13
  beta?: boolean;
14
14
  disabled?: boolean;
15
+ disabledBadge?: string;
16
+ type?: "button" | "video" | "text" | "image" | "mix";
17
+ attributes?: any;
18
+ blocks?: ICustomBlockMixContent[];
19
+ };
20
+ type ICustomBlockMixContent = {
21
+ type: "button" | "video" | "text" | "image";
22
+ attributes: any;
23
+ content?: string;
15
24
  };
16
25
  export type BlockClickedEvent = {
17
26
  type: BlockType;
@@ -0,0 +1,8 @@
1
+ type HelpOptions = {
2
+ text: string;
3
+ url: string;
4
+ };
5
+ export default interface IHelpdesk {
6
+ variants?: HelpOptions;
7
+ }
8
+ export {};
@@ -1,4 +1,5 @@
1
1
  import IAPI from "./API/API";
2
+ import IAPIBlockProperties from "./APIBlocks/APIBlocks";
2
3
  import ISavedBlock from "./SavedBlock/ISavedBlock";
3
4
  import INotification from "./Notification/INotification";
4
5
  import IMergeTagGroup from "./MergeTag/IMergeTagGroup";
@@ -10,105 +11,32 @@ import ICustomBlockData from "./CustomBlocks/CustomBlocks";
10
11
  import { Language } from "./Language/Language";
11
12
  import IMergeTag from "./MergeTag/IMergeTag";
12
13
  import SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
14
+ import IUser from "./User/User";
15
+ import IHelpdesk from "./Helpdesk/Helpdesk";
13
16
  type TopolTagAttribute = "font-family" | "font-size" | "font-weight" | "font-style" | "letter-spacing" | "text-transform" | "text-decoration" | "background-color" | "color" | "border-collapse";
14
- type IBlockProperties = {
15
- name: string;
16
- pluralName: string;
17
- icon: string;
18
- blockStructure: any;
19
- apiStructure?: any;
20
- itemsURL?: string;
21
- feedsURL?: string;
22
- apiWithoutSearch?: boolean;
23
- nextKey?: boolean;
24
- beta?: boolean;
25
- disabled?: boolean;
26
- };
27
17
  export default interface ITopolOptions {
28
18
  id: string;
29
19
  authorize: {
30
20
  apiKey: string;
31
21
  userId: string | number;
32
22
  };
33
- title?: string;
34
- renameTemplate?: boolean;
35
- removeTopBar?: boolean;
36
- topBarOptions?: Array<string>;
37
- mainMenuAlign?: "left" | "right";
38
- disableAlerts?: boolean;
39
- customFileManager?: boolean;
40
- language?: Language;
41
- light?: boolean;
42
- theme?: ITheme;
43
- hideSettingsTab?: boolean;
44
- imageEditor?: boolean;
45
- premadeBlocks?: Record<any, any> | boolean;
46
- savedBlocks?: Array<ISavedBlock> | boolean;
47
- mergeTags?: Array<IMergeTagGroup | IMergeTag>;
48
- enableAutosaves?: boolean;
49
- htmlMinified?: boolean;
50
- apiAuthorizationHeader?: IAuthHeaderConfig | string;
51
- contentBlocks?: IContentBlockOptions;
52
- callbacks: {
53
- onSave?(json: unknown, html: unknown): void;
54
- onSaveAndClose?(json: unknown, html: unknown): void;
55
- onTestSend?(email: string | string[], json: unknown, html: unknown): void;
56
- onOpenFileManager?(): void;
57
- onLoaded?(): void;
58
- onBlockSave?(block: ISavedBlock): void;
59
- onBlockRemove?(blockId: number): void;
60
- onBlockEdit?(blockId: number): void;
61
- onInit?(): void;
62
- onUndoChange?(count: number): void;
63
- onRedoChange?(count: number): void;
64
- onPreview?(html: unknown): void;
65
- onAlert?(notification: INotification): void;
66
- onClose?(): void;
67
- onEdittedWithoutSaveChanged?(hasUnsavedChanges: boolean): void;
68
- onOpenCustomBlockDialog?(customBLock: unknown): void;
69
- onTemplateRename?(title: string): void;
70
- updateTestingEmailAddresses?(emails: string[]): void;
71
- };
72
23
  api?: IAPI;
73
- mobileFirstEnabled?: boolean;
74
- smartMergeTags?: {
75
- enabled: boolean;
76
- patterns?: Record<string, SmartMergeTagPattern>;
77
- syntax?: {
78
- start: string;
79
- end: string;
80
- };
81
- };
82
- customFonts?: {
83
- override?: boolean;
84
- fonts: Array<IFont>;
85
- };
86
- tinyConfig?: unknown;
87
- fontSizes?: Array<number>;
88
- colors?: Array<string>;
89
- googleApiKey?: string;
90
- role?: "manager" | "editor" | "reader";
91
- windowBar?: Array<string>;
92
- imageMaxSize?: number;
24
+ apiAuthorizationHeader?: IAuthHeaderConfig | string;
25
+ apiBlocks?: Record<string, IAPIBlockProperties>;
93
26
  autosaveInterval?: number;
94
27
  betaFeatures?: {
95
28
  carousel?: boolean;
96
29
  };
30
+ chatAI?: boolean;
31
+ colors?: Array<string>;
32
+ contentBlocks?: IContentBlockOptions;
33
+ currentUser?: IUser;
97
34
  customBlocks?: ICustomBlockData[];
98
- imageCompressionOptions?: {
99
- qualityJpeg?: number;
100
- qualityPng?: number;
101
- enableAutoResize?: boolean;
102
- enableCompression?: boolean;
35
+ customFileManager?: boolean;
36
+ customFonts?: {
37
+ override?: boolean;
38
+ fonts: Array<IFont>;
103
39
  };
104
- premadeTemplates?: boolean;
105
- disableAiAssistant?: boolean;
106
- chatAI?: boolean;
107
- enableImageToTextRatio?: boolean;
108
- enableTemplateSizeInfo?: boolean;
109
- showUnsavedDialogBeforeExit?: boolean;
110
- enableSectionVariants?: boolean;
111
- enableComments?: boolean;
112
40
  defaultTemplateSettings?: {
113
41
  emailWidth?: number;
114
42
  emailBackgroundColor?: string;
@@ -131,8 +59,83 @@ export default interface ITopolOptions {
131
59
  [key in TopolTagAttribute]?: string;
132
60
  };
133
61
  "line-height"?: number;
62
+ "structure-margin"?: string;
63
+ };
64
+ disableAiAssistant?: boolean;
65
+ disableAlerts?: boolean;
66
+ disableExtendedComparators?: boolean;
67
+ emailServiceProvider?: "mailchimp" | "sparkpost";
68
+ enableAutosaves?: boolean;
69
+ enableComments?: boolean;
70
+ enableImageToTextRatio?: boolean;
71
+ enableMergeTagPreview?: boolean;
72
+ enableSectionVariants?: boolean;
73
+ enableTemplateSizeInfo?: boolean;
74
+ fontSizes?: Array<number>;
75
+ googleApiKey?: string;
76
+ helpdesk?: IHelpdesk;
77
+ hideSettingsTab?: boolean;
78
+ htmlDesktopFirst?: boolean;
79
+ htmlMinified?: boolean;
80
+ imageCompressionOptions?: {
81
+ qualityJpeg?: number;
82
+ qualityPng?: number;
83
+ enableAutoResize?: boolean;
84
+ enableCompression?: boolean;
85
+ };
86
+ imageEditor?: boolean;
87
+ imageMaxSize?: number;
88
+ language?: Language;
89
+ light?: boolean;
90
+ logicalOperatorsInsideVariant?: boolean;
91
+ mainMenuAlign?: "left" | "right";
92
+ mergeTags?: Array<IMergeTagGroup | IMergeTag>;
93
+ mobileFirstEnabled?: boolean;
94
+ premadeBlocks?: Record<any, any> | boolean;
95
+ premadeTemplates?: boolean;
96
+ role?: "manager" | "editor" | "reader";
97
+ savedBlocks?: Array<ISavedBlock> | boolean;
98
+ showUnsavedDialogBeforeExit?: boolean;
99
+ smartMergeTags?: {
100
+ enabled: boolean;
101
+ patterns?: Record<string, SmartMergeTagPattern>;
102
+ syntax?: {
103
+ start: string;
104
+ end: string;
105
+ };
134
106
  };
107
+ syncedRowsEnable?: boolean;
108
+ teamUsers?: IUser[];
109
+ templateId?: number | string;
135
110
  testingEmails?: boolean | string[];
136
- apiBlocks?: Record<string, IBlockProperties>;
111
+ theme?: ITheme;
112
+ tinyConfig?: unknown;
113
+ title?: string;
114
+ topBarOptions?: Array<string>;
115
+ renameTemplate?: boolean;
116
+ removeTopBar?: boolean;
117
+ windowBar?: Array<string>;
118
+ callbacks: {
119
+ onSave?(json: unknown, html: unknown): void;
120
+ onSaveAndClose?(json: unknown, html: unknown): void;
121
+ onTestSend?(email: string | string[], json: unknown, html: unknown): void;
122
+ onBannerClick?(json: unknown, html: unknown): void;
123
+ onOpenFileManager?(): void;
124
+ onLoaded?(): void;
125
+ onBlockSave?(block: ISavedBlock): void;
126
+ onBlockRemove?(blockId: number): void;
127
+ onBlockEdit?(blockId: number): void;
128
+ onInit?(): void;
129
+ onUndoChange?(count: number): void;
130
+ onRedoChange?(count: number): void;
131
+ onPreview?(html: unknown): void;
132
+ onAlert?(notification: INotification): void;
133
+ onClose?(): void;
134
+ onEdittedWithoutSaveChanged?(hasUnsavedChanges: boolean): void;
135
+ onOpenCustomBlockDialog?(customBLock: unknown): void;
136
+ onTemplateRename?(title: string): void;
137
+ updateTestingEmailAddresses?(emails: string[]): void;
138
+ onError?(type: string, message: string): void;
139
+ };
137
140
  }
138
141
  export {};
@@ -10,16 +10,17 @@ export default interface ITopolPlugin {
10
10
  chooseFile: (url: string) => void;
11
11
  undo: () => void;
12
12
  redo: () => void;
13
+ destroy: () => void;
13
14
  setSavedBlocks: (savedBlocks: ISavedBlock[]) => void;
15
+ setPreviewHTML: (html: unknown) => void;
14
16
  createNotification: (notification: INotification) => void;
17
+ setActiveMembers: (activeMemers: string[]) => void;
15
18
  changeEmailToMobile: () => void;
16
19
  changeEmailToDesktop: () => void;
17
20
  toggleBlocksAndStructuresVisibility: () => void;
18
- destroy: () => void;
19
- setPreviewHTML: (html: unknown) => void;
20
- setActiveMembers: (activeMemers: string[]) => void;
21
21
  updateCustomBlockContent: (content: string) => void;
22
22
  refreshComments: (key: string) => void;
23
+ refreshSyncedRows: () => void;
23
24
  openPremadeTemplatesSelection: () => void;
24
25
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
25
26
  setTemplateName: (name: string) => void;
@@ -2,4 +2,5 @@ export default interface IMergeTag {
2
2
  value: string;
3
3
  text: string;
4
4
  label: string;
5
+ defaultValue?: string;
5
6
  }
@@ -2,4 +2,5 @@ export default interface ISavedBlock {
2
2
  id: number;
3
3
  name: string;
4
4
  definition: unknown;
5
+ img?: string;
5
6
  }
@@ -0,0 +1,5 @@
1
+ export default interface IUser {
2
+ userId: string;
3
+ name: string;
4
+ profilePhotoUrl: string;
5
+ }
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": "0.0.4",
15
+ "version": "0.1.0",
16
16
  "files": [
17
17
  "dist"
18
18
  ],