@topol.io/editor 0.2.0 → 0.3.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.
@@ -1,45 +1,63 @@
1
- function r(e) {
1
+ function s(e) {
2
2
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var u = function(t, o, i) {
5
- var l = document.head || document.getElementsByTagName("head")[0], n = document.createElement("script");
4
+ var g = function(n, o, i) {
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
- }, 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);
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);
8
+ var a = "onload" in t ? u : c;
9
+ a(t, i), t.onload || u(t, i), l.appendChild(t);
10
10
  };
11
- function s(e, t) {
12
- for (var o in t)
13
- e.setAttribute(o, t[o]);
11
+ function w(e, n) {
12
+ for (var o in n)
13
+ e.setAttribute(o, n[o]);
14
14
  }
15
- function a(e, t) {
15
+ function u(e, n) {
16
16
  e.onload = function() {
17
- this.onerror = this.onload = null, t(null, e);
17
+ this.onerror = this.onload = null, n(null, e);
18
18
  }, e.onerror = function() {
19
- this.onerror = this.onload = null, t(new Error("Failed to load " + this.src), e);
19
+ this.onerror = this.onload = null, n(new Error("Failed to load " + this.src), e);
20
20
  };
21
21
  }
22
- function c(e, t) {
22
+ function c(e, n) {
23
23
  e.onreadystatechange = function() {
24
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, t(null, e));
24
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, e));
25
25
  };
26
26
  }
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") {
27
+ const d = /* @__PURE__ */ s(g), r = "https://v3.email-assets.topol.io/loader/build.js", p = "https://v3.develop.email-assets.topol.io/loader/build.js", P = "https://v3.develop.email-assets.topol.io/loader/build.js";
28
+ function T(e = "production") {
29
29
  switch (e) {
30
30
  case "dev":
31
31
  return p;
32
32
  case "staging":
33
- return T;
33
+ return P;
34
+ case "production":
35
+ return r;
34
36
  default:
35
- return g;
37
+ return `https://d10h8ga60f7b91.cloudfront.net/preview-app-${e}/loader/build.js`;
36
38
  }
37
39
  }
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);
40
+ async function m(e) {
41
+ return new Promise((n, o) => {
42
+ d(r, (i) => {
43
+ i !== null && o(i), window.TopolPlugin.init(e), n(!0);
44
+ });
45
+ });
46
+ }
47
+ const h = {
48
+ init: (e, n) => new Promise((o, i) => {
49
+ const l = T(n == null ? void 0 : n.stage);
50
+ d(l, async (t) => {
51
+ if (t !== null) {
52
+ if (l !== r)
53
+ try {
54
+ return await m(e), o(!0);
55
+ } catch (a) {
56
+ i(a);
57
+ }
58
+ i(t);
59
+ }
60
+ window.TopolPlugin.init(e), o(!0);
43
61
  });
44
62
  }),
45
63
  save: () => {
@@ -104,8 +122,29 @@ const f = {
104
122
  },
105
123
  setTemplateName: (e) => {
106
124
  window.TopolPlugin.setTemplateName(e);
125
+ },
126
+ toggleChatAI: () => {
127
+ window.TopolPlugin.toggleChatAI();
128
+ },
129
+ toggleAutosaves: () => {
130
+ window.TopolPlugin.toggleAutosaves();
131
+ },
132
+ toggleComments: () => {
133
+ window.TopolPlugin.toggleComments();
134
+ },
135
+ createLanguage: (e) => {
136
+ window.TopolPlugin.createLanguage(e);
137
+ },
138
+ setPrimaryLanguage: (e) => {
139
+ window.TopolPlugin.setPrimaryLanguage(e);
140
+ },
141
+ deleteLanguage: (e) => {
142
+ window.TopolPlugin.deleteLanguage(e);
143
+ },
144
+ selectLanguage: (e) => {
145
+ window.TopolPlugin.selectLanguage(e);
107
146
  }
108
147
  };
109
148
  export {
110
- f as default
149
+ h as default
111
150
  };
@@ -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 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)}}});
1
+ (function(l,a){typeof exports=="object"&&typeof module<"u"?module.exports=a():typeof define=="function"&&define.amd?define(a):(l=typeof globalThis<"u"?globalThis:l||self,l["topol-plugin"]=a())})(this,function(){"use strict";function l(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var a=function(n,o,i){var u=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&&w(t,o.attrs),o.text&&(t.text=""+o.text);var r="onload"in t?s:c;r(t,i),t.onload||s(t,i),u.appendChild(t)};function w(e,n){for(var o in n)e.setAttribute(o,n[o])}function s(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 c(e,n){e.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,n(null,e))}}const g=l(a),d="https://v3.email-assets.topol.io/loader/build.js",p="https://v3.develop.email-assets.topol.io/loader/build.js",T="https://v3.develop.email-assets.topol.io/loader/build.js";function P(e="production"){switch(e){case"dev":return p;case"staging":return T;case"production":return d;default:return`https://d10h8ga60f7b91.cloudfront.net/preview-app-${e}/loader/build.js`}}async function f(e){return new Promise((n,o)=>{g(d,i=>{i!==null&&o(i),window.TopolPlugin.init(e),n(!0)})})}return{init:(e,n)=>new Promise((o,i)=>{const u=P(n==null?void 0:n.stage);g(u,async t=>{if(t!==null){if(u!==d)try{return await f(e),o(!0)}catch(r){i(r)}i(t)}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)}}});
@@ -42,6 +42,13 @@ declare const TopolPlugin: {
42
42
  openPremadeTemplatesSelection: () => void;
43
43
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
44
44
  setTemplateName: (name: string) => void;
45
+ toggleChatAI: () => void;
46
+ toggleAutosaves: () => void;
47
+ toggleComments: () => void;
48
+ createLanguage: (lang: string) => void;
49
+ setPrimaryLanguage: (lang: string) => void;
50
+ deleteLanguage: (lang: string) => void;
51
+ selectLanguage: (lang: string) => void;
45
52
  };
46
53
  export default TopolPlugin;
47
54
  export type { ITopolOptions, INotification, ISavedBlock, IMergeTagGroup, IMergeTag, IContentBlockOptions, ITheme, IAuthHeaderConfig, IFont, IAPI, ICustomBlockData, Stage as IStage };
@@ -27,4 +27,11 @@ export default interface ITopolPlugin {
27
27
  updateApiAuthorizationHeader: (newHeader: string | Record<string, string>) => void;
28
28
  setTemplateName: (name: string) => void;
29
29
  setMergeTags: (mergeTags: Array<IMergeTagGroup | IMergeTag>) => void;
30
+ toggleChatAI: () => void;
31
+ toggleAutosaves: () => void;
32
+ toggleComments: () => void;
33
+ createLanguage: (lang: string) => void;
34
+ setPrimaryLanguage: (lang: string) => void;
35
+ deleteLanguage: (lang: string) => void;
36
+ selectLanguage: (lang: string) => void;
30
37
  }
@@ -1 +1 @@
1
- export type Stage = "dev" | "staging" | "production";
1
+ export type Stage = "dev" | "staging" | "production" | number;
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.2.0",
15
+ "version": "0.3.0",
16
16
  "files": [
17
17
  "dist"
18
18
  ],