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

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
@@ -1,5 +1,5 @@
1
1
  <a href="https://topol.io" target="_blank">
2
- <img src="https://storage.googleapis.com/topolio17326/plugin-assets/6320/17326/topol-with-bg.png" alt="Tailwind CSS" width="400" height="120">
2
+ <svg width="391" height="100" viewBox="0 0 391 100" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M198.658 24.5069C194.15 21.9659 188.894 20.6954 182.903 20.6954C176.911 20.6954 171.655 21.9659 167.103 24.5069C162.561 27.0478 159.024 30.5918 156.525 35.161C154.003 39.7192 152.765 45.024 152.765 51.0755C152.765 57.1269 154.014 62.376 156.558 66.9341C159.08 71.5034 162.617 75.0474 167.136 77.5883C171.678 80.1293 176.922 81.3998 182.914 81.3998C188.906 81.3998 194.116 80.1293 198.635 77.5883C203.177 75.0474 206.703 71.5034 209.224 66.9341C211.746 62.376 213.018 57.0824 213.018 51.0755C213.018 45.0685 211.746 39.7192 209.224 35.161C206.703 30.5918 203.177 27.0478 198.658 24.5069ZM198.011 60.604C196.593 63.3233 194.585 65.4296 192.008 66.9119C189.43 68.4052 186.395 69.1519 182.914 69.1519C179.432 69.1519 176.386 68.4052 173.798 66.9119C171.209 65.4296 169.2 63.3233 167.772 60.604C166.344 57.8848 165.641 54.7086 165.641 51.0755C165.641 47.4423 166.344 44.2216 167.772 41.5134C169.2 38.8165 171.198 36.699 173.775 35.2056C176.353 33.7011 179.399 32.9433 182.914 32.9433C186.428 32.9433 189.43 33.7011 192.008 35.2056C194.585 36.699 196.593 38.8165 198.011 41.5134C199.439 44.2216 200.153 47.3978 200.153 51.0755C200.153 54.7532 199.439 57.8959 198.011 60.604ZM332.387 24.5069C327.879 21.9659 322.635 20.6954 316.643 20.6954C310.651 20.6954 305.384 21.9659 300.843 24.5069C296.291 27.0478 292.753 30.5918 290.254 35.161C287.744 39.7192 286.494 45.024 286.494 51.0755C286.494 57.1269 287.755 62.376 290.288 66.9341C292.809 71.5034 296.335 75.0474 300.876 77.5883C305.407 80.1293 310.651 81.3998 316.654 81.3998C322.657 81.3998 327.834 80.1293 332.376 77.5883C336.906 75.0474 340.432 71.5034 342.953 66.9341C345.475 62.376 346.747 57.0824 346.747 51.0755C346.747 45.0685 345.475 39.7192 342.953 35.161C340.432 30.5918 336.906 27.0478 332.387 24.5069ZM331.751 60.604C330.323 63.3233 328.325 65.4296 325.748 66.9119C323.159 68.4052 320.124 69.1519 316.654 69.1519C313.184 69.1519 310.126 68.4052 307.527 66.9119C304.938 65.4296 302.93 63.3233 301.501 60.604C300.084 57.8848 299.37 54.7086 299.37 51.0755C299.37 47.4423 300.084 44.2216 301.501 41.5134C302.93 38.8165 304.927 36.699 307.504 35.2056C310.082 33.7011 313.139 32.9433 316.654 32.9433C320.169 32.9433 323.159 33.7011 325.748 35.2056C328.325 36.699 330.323 38.8165 331.751 41.5134C333.168 44.2216 333.882 47.3978 333.882 51.0755C333.882 54.7532 333.168 57.8959 331.751 60.604ZM267.971 24.44C263.798 21.9436 258.889 20.6954 253.276 20.6954C248.043 20.6954 243.591 21.8656 239.942 24.1837C236.963 26.0782 234.575 28.7195 232.768 32.0517V21.8767H219.3V100H232.768V69.464C234.575 72.7962 236.952 75.4263 239.942 77.3208C243.591 79.6612 248.043 80.8091 253.276 80.8091C258.889 80.8091 263.798 79.5609 267.971 77.0311C272.156 74.5236 275.414 71.0019 277.757 66.4772C280.1 61.9637 281.283 56.7034 281.283 50.7188C281.283 44.7342 280.1 39.474 277.757 34.9604C275.414 30.4358 272.145 26.9252 267.971 24.44ZM266.186 60.1137C264.736 62.7995 262.694 64.8724 260.072 66.3435C257.449 67.8257 254.359 68.5612 250.81 68.5612C247.262 68.5612 244.171 67.8257 241.549 66.3435C238.916 64.8724 236.874 62.7995 235.435 60.1137C233.984 57.439 233.248 54.3185 233.248 50.7411C233.248 47.1637 233.973 43.9987 235.435 41.3351C236.874 38.6827 238.916 36.6098 241.549 35.1499C244.171 33.6788 247.262 32.9544 250.81 32.9544C254.359 32.9544 257.483 33.69 260.094 35.1499C262.705 36.6098 264.724 38.6827 266.186 41.3574C267.626 44.0321 268.362 47.1526 268.362 50.7411C268.362 54.3297 267.637 57.4501 266.186 60.1137ZM391 66.7781V80.2407H366.408V66.7781H391ZM366.397 0V66.7781H352.918V0H366.397ZM127.38 21.7096H149.607V35.1722H127.38V66.7893H113.79V0H127.38V21.7096ZM127.38 66.7781H147.152V80.2407H127.38V66.7781ZM80.3379 66.8004V80.263H60.2534V66.8004H80.3379ZM0 66.8004H20.0845V80.263H0V66.8004ZM0.0223161 50.1727V30.1126H20.0845V50.1727H0.0223161ZM60.2534 50.1727V30.1126H20.0845V13.4849H60.2534V30.1126H80.3044V50.1727H60.2534ZM20.0845 50.1727H60.2534V66.8004H20.0845V50.1727ZM0 13.4738V0.0222891H20.0845V13.4849L0 13.4738ZM80.3379 13.4738H60.2534V0.0222891H80.3379V13.4738Z" fill="black"/></svg>
3
3
  </a>
4
4
 
5
5
  ---
@@ -1,14 +1,14 @@
1
1
  function s(e) {
2
2
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var c = function(n, o, i) {
4
+ var w = function(n, o, i) {
5
5
  var l = document.head || document.getElementsByTagName("head")[0], t = document.createElement("script");
6
6
  typeof o == "function" && (i = o, o = {}), o = o || {}, i = i || function() {
7
- }, t.type = o.type || "text/javascript", t.charset = o.charset || "utf8", t.async = "async" in o ? !!o.async : !0, t.src = n, o.attrs && w(t, o.attrs), o.text && (t.text = "" + o.text);
7
+ }, t.type = o.type || "text/javascript", t.charset = o.charset || "utf8", t.async = "async" in o ? !!o.async : !0, t.src = n, o.attrs && c(t, o.attrs), o.text && (t.text = "" + o.text);
8
8
  var r = "onload" in t ? g : p;
9
9
  r(t, i), t.onload || g(t, i), l.appendChild(t);
10
10
  };
11
- function w(e, n) {
11
+ function c(e, n) {
12
12
  for (var o in n)
13
13
  e.setAttribute(o, n[o]);
14
14
  }
@@ -24,7 +24,7 @@ function p(e, n) {
24
24
  this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, e));
25
25
  };
26
26
  }
27
- const d = /* @__PURE__ */ s(c);
27
+ const d = /* @__PURE__ */ s(w);
28
28
  var u = { BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
29
29
  const a = {
30
30
  production: u.VITE_TOPOL_URL,
@@ -43,7 +43,7 @@ function T(e = "production") {
43
43
  return P.replace("{stage}", String(e));
44
44
  }
45
45
  }
46
- async function f(e) {
46
+ async function m(e) {
47
47
  return new Promise((n, o) => {
48
48
  d(a.production, (i) => {
49
49
  if (i !== null) {
@@ -54,7 +54,7 @@ async function f(e) {
54
54
  });
55
55
  });
56
56
  }
57
- const m = {
57
+ const f = {
58
58
  /**
59
59
  * Initialize the Email Editor.
60
60
  * @param topolOptions - Configuration options for the editor
@@ -67,7 +67,7 @@ const m = {
67
67
  if (t !== null) {
68
68
  if (l !== a.production)
69
69
  try {
70
- return await f(e), o(!0);
70
+ return await m(e), o(!0);
71
71
  } catch (r) {
72
72
  i(r);
73
73
  }
@@ -78,8 +78,8 @@ const m = {
78
78
  });
79
79
  }),
80
80
  /** Trigger the save callback with current editor content */
81
- save: () => {
82
- window.TopolPlugin.save();
81
+ save: (e) => {
82
+ window.TopolPlugin.save(e);
83
83
  },
84
84
  /** Load a template JSON into the editor */
85
85
  load: (e) => {
@@ -161,6 +161,9 @@ const m = {
161
161
  setTemplateName: (e) => {
162
162
  window.TopolPlugin.setTemplateName(e);
163
163
  },
164
+ updateOptions: (e) => {
165
+ window.TopolPlugin.updateOptions(e);
166
+ },
164
167
  /** Toggle the AI chat feature */
165
168
  toggleChatAI: () => {
166
169
  window.TopolPlugin.toggleChatAI();
@@ -188,6 +191,18 @@ const m = {
188
191
  /** Select/switch to a language */
189
192
  selectLanguage: (e) => {
190
193
  window.TopolPlugin.selectLanguage(e);
194
+ },
195
+ /** Toggle the control panel visibility */
196
+ toggleControlPanel: () => {
197
+ window.TopolPlugin.toggleControlPanel();
198
+ },
199
+ /** Update the editor template with new JSON data */
200
+ updateTemplate: (e, n) => {
201
+ window.TopolPlugin.updateTemplate(e, n);
202
+ },
203
+ /** Toggle dark mode for the editor */
204
+ toggleDarkMode: () => {
205
+ window.TopolPlugin.toggleDarkMode();
191
206
  }
192
207
  }, h = "https://v1.page-assets.topol.io/topol-lpe.js", E = {
193
208
  /**
@@ -207,9 +222,9 @@ const m = {
207
222
  o(t);
208
223
  });
209
224
  })
210
- }, v = m;
225
+ }, v = f;
211
226
  export {
212
- m as EmailEditor,
227
+ f as EmailEditor,
213
228
  E as LandingPageEditor,
214
229
  v as TopolPlugin,
215
230
  v as default
@@ -1 +1 @@
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"}})});
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?w:f;s(t,i),t.onload||w(t,i),a.appendChild(t)};function P(e,n){for(var o in n)e.setAttribute(o,n[o])}function w(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 r=u(T);var g={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const d={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 d.dev;case"staging":return d.staging;case"production":return d.production;default:return m.replace("{stage}",String(e))}}async function E(e){return new Promise((n,o)=>{r(d.production,i=>{if(i!==null){o(i);return}window.TopolPlugin.init(e),n(!0)})})}const c={init:(e,n)=>new Promise((o,i)=>{const a=h(n==null?void 0:n.stage);r(a,async t=>{if(t!==null){if(a!==d.production)try{return await E(e),o(!0)}catch(s){i(s)}i(t);return}window.TopolPlugin.init(e),o(!0)})}),save:e=>{window.TopolPlugin.save(e)},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)},updateOptions:e=>{window.TopolPlugin.updateOptions(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)},toggleControlPanel:()=>{window.TopolPlugin.toggleControlPanel()},updateTemplate:(e,n)=>{window.TopolPlugin.updateTemplate(e,n)},toggleDarkMode:()=>{window.TopolPlugin.toggleDarkMode()}},v="https://v1.page-assets.topol.io/topol-lpe.js",y={init:(e,n)=>new Promise((o,i)=>{r(v,a=>{if(a!==null){i(a);return}const t=window.LandingPageEditor(e);o(t)})})},p=c;l.EmailEditor=c,l.LandingPageEditor=y,l.TopolPlugin=p,l.default=p,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
@@ -39,7 +39,7 @@ export declare const EmailEditor: {
39
39
  */
40
40
  init: (topolOptions: ITopolOptions, options?: EmailEditorPluginOptions) => Promise<boolean | string>;
41
41
  /** Trigger the save callback with current editor content */
42
- save: () => void;
42
+ save: (lang?: string) => void;
43
43
  /** Load a template JSON into the editor */
44
44
  load: (json: unknown) => void;
45
45
  /** Toggle the preview mode */
@@ -80,6 +80,7 @@ export declare const EmailEditor: {
80
80
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
81
81
  /** Set the template name/title */
82
82
  setTemplateName: (name: string) => void;
83
+ updateOptions: (options: Partial<ITopolOptions>) => void;
83
84
  /** Toggle the AI chat feature */
84
85
  toggleChatAI: () => void;
85
86
  /** Toggle the autosaves feature */
@@ -94,4 +95,12 @@ export declare const EmailEditor: {
94
95
  deleteLanguage: (lang: string) => void;
95
96
  /** Select/switch to a language */
96
97
  selectLanguage: (lang: string) => void;
98
+ /** Toggle the control panel visibility */
99
+ toggleControlPanel: () => void;
100
+ /** Update the editor template with new JSON data */
101
+ updateTemplate: (json: unknown, options?: {
102
+ skipSnapshot?: boolean;
103
+ }) => void;
104
+ /** Toggle dark mode for the editor */
105
+ toggleDarkMode: () => void;
97
106
  };
@@ -41,7 +41,7 @@ import { EmailEditor } from "./email-editor";
41
41
  */
42
42
  declare const TopolPlugin: {
43
43
  init: (topolOptions: ITopolOptions, options?: import("./email-editor").EmailEditorPluginOptions | undefined) => Promise<string | boolean>;
44
- save: () => void;
44
+ save: (lang?: string | undefined) => void;
45
45
  load: (json: unknown) => void;
46
46
  togglePreview: () => void;
47
47
  togglePreviewSize: () => void;
@@ -62,6 +62,7 @@ declare const TopolPlugin: {
62
62
  openPremadeTemplatesSelection: () => void;
63
63
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
64
64
  setTemplateName: (name: string) => void;
65
+ updateOptions: (options: Partial<ITopolOptions>) => void;
65
66
  toggleChatAI: () => void;
66
67
  toggleAutosaves: () => void;
67
68
  toggleComments: () => void;
@@ -69,6 +70,11 @@ declare const TopolPlugin: {
69
70
  setPrimaryLanguage: (lang: string) => void;
70
71
  deleteLanguage: (lang: string) => void;
71
72
  selectLanguage: (lang: string) => void;
73
+ toggleControlPanel: () => void;
74
+ updateTemplate: (json: unknown, options?: {
75
+ skipSnapshot?: boolean | undefined;
76
+ } | undefined) => void;
77
+ toggleDarkMode: () => void;
72
78
  };
73
79
  import { LandingPageEditor } from "./landing-page-editor";
74
80
  import type ITopolOptions from "../types/ITopolOptions";
@@ -9,6 +9,11 @@
9
9
  export interface ISaveData {
10
10
  json: unknown;
11
11
  html: unknown;
12
+ mutations?: {
13
+ key: string;
14
+ primary: boolean;
15
+ }[];
16
+ syncedSections?: number[];
12
17
  }
13
18
  /**
14
19
  * Payload for onError callback.
@@ -8,14 +8,24 @@ export default interface IEmailCallbacks {
8
8
  * Called when the user saves the email template.
9
9
  * @param json - The email template JSON structure
10
10
  * @param html - The generated HTML output
11
+ * @param mutations - The mutations applied to the email template
12
+ * @param syncedSections - The synced sections id that were in the email template at the time of saving
11
13
  */
12
- onSave?(json: unknown, html: unknown): void;
14
+ onSave?(json: unknown, html: unknown, mutations: {
15
+ key: string;
16
+ primary: boolean;
17
+ }[], syncedSections: number[]): void;
13
18
  /**
14
19
  * Called when the user clicks "Save and Close".
15
20
  * @param json - The email template JSON structure
16
21
  * @param html - The generated HTML output
22
+ * @param mutations - The mutations applied to the email template
23
+ * @param syncedSections - The synced sections id that were in the email template at the time of saving
17
24
  */
18
- onSaveAndClose?(json: unknown, html: unknown): void;
25
+ onSaveAndClose?(json: unknown, html: unknown, mutations: {
26
+ key: string;
27
+ primary: boolean;
28
+ }[], syncedSections: number[]): void;
19
29
  /**
20
30
  * Called when the user sends a test email.
21
31
  * @param email - The email address(es) to send to
@@ -7,13 +7,17 @@ import type ITheme from "./Theme/ITheme";
7
7
  import type IAuthHeaderConfig from "./AuthHeaderConfig/IAuthHeaderConfig";
8
8
  import type IFont from "./Font/IFont";
9
9
  import type ICustomBlockData from "./CustomBlocks/CustomBlocks";
10
- import type { Language } from "./Language/Language";
10
+ import type { Language, IMultilingualLanguage } from "./Language/Language";
11
11
  import type IMergeTag from "./MergeTag/IMergeTag";
12
12
  import type SmartMergeTagPattern from "./MergeTag/SmartMergeTagPattern";
13
13
  import type IUser from "./User/User";
14
14
  import type IHelpdesk from "./Helpdesk/Helpdesk";
15
15
  import type IEmailCallbacks from "./Callbacks/IEmailCallbacks";
16
16
  type TopolTagAttribute = "font-family" | "font-size" | "font-weight" | "font-style" | "letter-spacing" | "text-transform" | "text-decoration" | "background-color" | "color" | "border-collapse";
17
+ type DefaultTemplateLangsSchema = {
18
+ key: string;
19
+ primary: boolean;
20
+ }[];
17
21
  /**
18
22
  * Configuration options for the Email Editor (TopolPlugin).
19
23
  */
@@ -29,6 +33,7 @@ export default interface ITopolOptions {
29
33
  autosaveInterval?: number;
30
34
  betaFeatures?: {
31
35
  carousel?: boolean;
36
+ loop?: boolean;
32
37
  };
33
38
  chatAI?: boolean;
34
39
  colors?: Array<string>;
@@ -40,6 +45,10 @@ export default interface ITopolOptions {
40
45
  override?: boolean;
41
46
  fonts: Array<IFont>;
42
47
  };
48
+ customLanguagePreset?: {
49
+ langs: IMultilingualLanguage;
50
+ override?: boolean;
51
+ };
43
52
  defaultTemplateSettings?: {
44
53
  emailWidth?: number;
45
54
  emailBackgroundColor?: string;
@@ -63,6 +72,8 @@ export default interface ITopolOptions {
63
72
  };
64
73
  "line-height"?: number;
65
74
  "structure-margin"?: string;
75
+ "stack-columns"?: boolean;
76
+ langs?: DefaultTemplateLangsSchema;
66
77
  };
67
78
  disableAiAssistant?: boolean;
68
79
  disableAlerts?: boolean;
@@ -70,14 +81,20 @@ export default interface ITopolOptions {
70
81
  emailServiceProvider?: "mailchimp" | "sparkpost";
71
82
  enableAutosaves?: boolean;
72
83
  enableComments?: boolean;
84
+ enableDarkMode?: boolean;
73
85
  enableImageToTextRatio?: boolean;
74
86
  enableMergeTagPreview?: boolean;
75
87
  enableSectionVariants?: boolean;
76
88
  enableTemplateSizeInfo?: boolean;
89
+ fileManagerPreferences?: {
90
+ defaultTilesView?: boolean;
91
+ hidePexelsIntegration?: boolean;
92
+ };
77
93
  fontSizes?: Array<number>;
78
94
  googleApiKey?: string;
79
95
  helpdesk?: IHelpdesk;
80
96
  hideSettingsTab?: boolean;
97
+ hideControlPanel?: boolean;
81
98
  htmlDesktopFirst?: boolean;
82
99
  htmlMinified?: boolean;
83
100
  imageCompressionOptions?: {
@@ -87,6 +104,9 @@ export default interface ITopolOptions {
87
104
  enableCompression?: boolean;
88
105
  };
89
106
  imageEditor?: boolean;
107
+ imageEditorOptions?: {
108
+ hideControls?: Array<string>;
109
+ };
90
110
  imageMaxSize?: number;
91
111
  language?: Language;
92
112
  light?: boolean;
@@ -94,10 +114,19 @@ export default interface ITopolOptions {
94
114
  mainMenuAlign?: "left" | "right";
95
115
  mergeTags?: Array<IMergeTagGroup | IMergeTag>;
96
116
  mobileFirstEnabled?: boolean;
117
+ multilingual?: boolean;
97
118
  premadeBlocks?: Record<any, any> | boolean;
119
+ premadeBlocksNoOverwrite?: boolean;
98
120
  premadeTemplates?: boolean;
121
+ premadeTemplatesOptions?: {
122
+ hideSearch?: boolean;
123
+ showDelete?: boolean;
124
+ };
125
+ removeTopBar?: boolean;
126
+ renameTemplate?: boolean;
99
127
  role?: "manager" | "editor" | "reader";
100
128
  savedBlocks?: Array<ISavedBlock> | boolean;
129
+ showControlPanelExpand?: boolean;
101
130
  showUnsavedDialogBeforeExit?: boolean;
102
131
  smartMergeTags?: {
103
132
  enabled: boolean;
@@ -111,12 +140,16 @@ export default interface ITopolOptions {
111
140
  teamUsers?: IUser[];
112
141
  templateId?: number | string;
113
142
  testingEmails?: boolean | string[];
143
+ textEditor?: "tinymce" | "tiptap";
144
+ textEditorToolbarBottomPosition?: "left" | "center" | "right";
145
+ textOverride?: Record<string, string>;
114
146
  theme?: ITheme;
115
147
  tinyConfig?: unknown;
148
+ tiptapConfig?: {
149
+ light?: boolean;
150
+ };
116
151
  title?: string;
117
152
  topBarOptions?: Array<string>;
118
- renameTemplate?: boolean;
119
- removeTopBar?: boolean;
120
153
  windowBar?: Array<string>;
121
154
  callbacks: IEmailCallbacks;
122
155
  }
@@ -5,7 +5,7 @@ import IMergeTagGroup from "./MergeTag/IMergeTagGroup";
5
5
  import IMergeTag from "./MergeTag/IMergeTag";
6
6
  export default interface ITopolPlugin {
7
7
  init: (topolOptions: ITopolOptions) => void;
8
- save: () => void;
8
+ save: (lang?: string) => void;
9
9
  load: (json: unknown) => void;
10
10
  togglePreview: () => void;
11
11
  togglePreviewSize: () => void;
@@ -26,6 +26,7 @@ export default interface ITopolPlugin {
26
26
  openPremadeTemplatesSelection: () => void;
27
27
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
28
28
  setTemplateName: (name: string) => void;
29
+ updateOptions: (options: Partial<ITopolOptions>) => void;
29
30
  setMergeTags: (mergeTags: Array<IMergeTagGroup | IMergeTag>) => void;
30
31
  toggleChatAI: () => void;
31
32
  toggleAutosaves: () => void;
@@ -34,4 +35,9 @@ export default interface ITopolPlugin {
34
35
  setPrimaryLanguage: (lang: string) => void;
35
36
  deleteLanguage: (lang: string) => void;
36
37
  selectLanguage: (lang: string) => void;
38
+ toggleControlPanel: () => void;
39
+ updateTemplate: (json: unknown, options?: {
40
+ skipSnapshot?: boolean;
41
+ }) => void;
42
+ toggleDarkMode: () => void;
37
43
  }
@@ -1 +1,6 @@
1
1
  export type Language = "en" | "fr" | "pt" | "es" | "ja" | "zh" | "ru" | "tr" | "de" | "sv" | "nl" | "it" | "fi" | "ro" | "cs" | "pl" | "ko" | "vi" | "he";
2
+ export type IMultilingualLanguage = {
3
+ name: string;
4
+ code: string;
5
+ nativeName: string;
6
+ }[];
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.1",
15
+ "version": "1.0.0-alpha.2",
16
16
  "files": [
17
17
  "dist"
18
18
  ],