@topol.io/editor 0.3.0 → 1.0.0-alpha.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.
Files changed (54) hide show
  1. package/LICENSE +1 -1
  2. package/dist/topol-plugin.es.js +86 -20
  3. package/dist/topol-plugin.umd.js +1 -1
  4. package/dist/types/src/core/script-loader.d.ts +7 -0
  5. package/dist/types/src/email-editor/constants.d.ts +7 -0
  6. package/dist/types/src/email-editor/index.d.ts +97 -0
  7. package/dist/types/src/landing-page-editor/constants.d.ts +1 -0
  8. package/dist/types/src/landing-page-editor/index.d.ts +55 -0
  9. package/dist/types/src/landing-page-editor/schemas/ai/aiSchema.d.ts +15 -0
  10. package/dist/types/src/landing-page-editor/schemas/api/apiSchema.d.ts +33 -0
  11. package/dist/types/src/landing-page-editor/schemas/authHeaderConfig/authHeaderConfigScheme.d.ts +3 -0
  12. package/dist/types/src/landing-page-editor/schemas/autosave/autosaveSchema.d.ts +33 -0
  13. package/dist/types/src/landing-page-editor/schemas/comments/commentsSchema.d.ts +91 -0
  14. package/dist/types/src/landing-page-editor/schemas/contentBlock/contentBlockScheme.d.ts +470 -0
  15. package/dist/types/src/landing-page-editor/schemas/font/fontSchema.d.ts +12 -0
  16. package/dist/types/src/landing-page-editor/schemas/helpdesk/helpdeskSchema.d.ts +8 -0
  17. package/dist/types/src/landing-page-editor/schemas/image/imageSchema.d.ts +26 -0
  18. package/dist/types/src/landing-page-editor/schemas/language/languageSchema.d.ts +3 -0
  19. package/dist/types/src/landing-page-editor/schemas/mjmlStore/mjmlStoreSchema.d.ts +31 -0
  20. package/dist/types/src/landing-page-editor/schemas/notification/notificationSchema.d.ts +16 -0
  21. package/dist/types/src/landing-page-editor/schemas/openAI/openAISchema.d.ts +7 -0
  22. package/dist/types/src/landing-page-editor/schemas/pluginOptions/pluginOptionsSchema.d.ts +81 -0
  23. package/dist/types/src/landing-page-editor/schemas/premadeBlock/premadeBlockSchema.d.ts +59750 -0
  24. package/dist/types/src/landing-page-editor/schemas/premadeTemplates/premadeTemplatesSchema.d.ts +65 -0
  25. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockApiSchema.d.ts +44831 -0
  26. package/dist/types/src/landing-page-editor/schemas/savedBlock/savedBlockSchema.d.ts +59725 -0
  27. package/dist/types/src/landing-page-editor/schemas/template/blocks/buttonBlockSchema.d.ts +700 -0
  28. package/dist/types/src/landing-page-editor/schemas/template/blocks/carouselBlockSchema.d.ts +74 -0
  29. package/dist/types/src/landing-page-editor/schemas/template/blocks/dividerBlockSchema.d.ts +362 -0
  30. package/dist/types/src/landing-page-editor/schemas/template/blocks/imageAnGifBlockSchema.d.ts +1157 -0
  31. package/dist/types/src/landing-page-editor/schemas/template/blocks/index.d.ts +12 -0
  32. package/dist/types/src/landing-page-editor/schemas/template/blocks/rawBlockSchema.d.ts +45 -0
  33. package/dist/types/src/landing-page-editor/schemas/template/blocks/socialBlockSchema.d.ts +637 -0
  34. package/dist/types/src/landing-page-editor/schemas/template/blocks/spacerBlockSchema.d.ts +392 -0
  35. package/dist/types/src/landing-page-editor/schemas/template/blocks/textBlockSchema.d.ts +480 -0
  36. package/dist/types/src/landing-page-editor/schemas/template/blocks/videoBlockSchema.d.ts +333 -0
  37. package/dist/types/src/landing-page-editor/schemas/template/commonSchema.d.ts +265 -0
  38. package/dist/types/src/landing-page-editor/schemas/template/settingsSchema.d.ts +4812 -0
  39. package/dist/types/src/landing-page-editor/schemas/template/structure/blockSchema.d.ts +7502 -0
  40. package/dist/types/src/landing-page-editor/schemas/template/structure/columnSchema.d.ts +7983 -0
  41. package/dist/types/src/landing-page-editor/schemas/template/structure/sectionSchema.d.ts +15074 -0
  42. package/dist/types/src/landing-page-editor/schemas/template/styleSchema.d.ts +185 -0
  43. package/dist/types/src/landing-page-editor/schemas/templateSchema.d.ts +58720 -0
  44. package/dist/types/src/landing-page-editor/schemas/templateSettings/templateSettingsSchema.d.ts +4959 -0
  45. package/dist/types/src/landing-page-editor/schemas/theme/themeSchema.d.ts +40 -0
  46. package/dist/types/src/landing-page-editor/schemas/user/userSchema.d.ts +13 -0
  47. package/dist/types/src/landing-page-editor/schemas/utils/transformBorder.d.ts +9 -0
  48. package/dist/types/src/main.d.ts +71 -24
  49. package/dist/types/types/Callbacks/ICallbackPayloads.d.ts +29 -0
  50. package/dist/types/types/Callbacks/IEmailCallbacks.d.ts +109 -0
  51. package/dist/types/types/ITopolOptions.d.ts +20 -38
  52. package/dist/types/types/landing-page/ILandingPageEditorInstance.d.ts +19 -0
  53. package/dist/types/types/landing-page/ILandingPageOptions.d.ts +114 -0
  54. package/package.json +12 -6
package/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 Ecomail s.r.o.
1
+ Copyright 2022 Topol.io s.r.o.
2
2
 
3
3
  Licensed under the Apache License, Version 2.0 (the "License");
4
4
  you may not use this file except in compliance with the License.
@@ -1,150 +1,216 @@
1
1
  function s(e) {
2
2
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var g = function(n, o, i) {
4
+ var c = 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
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);
8
+ var r = "onload" in t ? g : p;
9
+ r(t, i), t.onload || g(t, i), l.appendChild(t);
10
10
  };
11
11
  function w(e, n) {
12
12
  for (var o in n)
13
13
  e.setAttribute(o, n[o]);
14
14
  }
15
- function u(e, n) {
15
+ function g(e, n) {
16
16
  e.onload = function() {
17
17
  this.onerror = this.onload = null, n(null, e);
18
18
  }, e.onerror = function() {
19
19
  this.onerror = this.onload = null, n(new Error("Failed to load " + this.src), e);
20
20
  };
21
21
  }
22
- function c(e, n) {
22
+ function p(e, n) {
23
23
  e.onreadystatechange = function() {
24
24
  this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, n(null, e));
25
25
  };
26
26
  }
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";
27
+ const d = /* @__PURE__ */ s(c);
28
+ var u = { BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
29
+ const a = {
30
+ production: u.VITE_TOPOL_URL,
31
+ dev: u.VITE_TOPOL_DEV_URL,
32
+ staging: u.VITE_TOPOL_STAGING_URL
33
+ }, P = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
28
34
  function T(e = "production") {
29
35
  switch (e) {
30
36
  case "dev":
31
- return p;
37
+ return a.dev;
32
38
  case "staging":
33
- return P;
39
+ return a.staging;
34
40
  case "production":
35
- return r;
41
+ return a.production;
36
42
  default:
37
- return `https://d10h8ga60f7b91.cloudfront.net/preview-app-${e}/loader/build.js`;
43
+ return P.replace("{stage}", String(e));
38
44
  }
39
45
  }
40
- async function m(e) {
46
+ async function f(e) {
41
47
  return new Promise((n, o) => {
42
- d(r, (i) => {
43
- i !== null && o(i), window.TopolPlugin.init(e), n(!0);
48
+ d(a.production, (i) => {
49
+ if (i !== null) {
50
+ o(i);
51
+ return;
52
+ }
53
+ window.TopolPlugin.init(e), n(!0);
44
54
  });
45
55
  });
46
56
  }
47
- const h = {
57
+ const m = {
58
+ /**
59
+ * Initialize the Email Editor.
60
+ * @param topolOptions - Configuration options for the editor
61
+ * @param options - Plugin options including stage selection
62
+ * @returns Promise that resolves to true when the editor is ready
63
+ */
48
64
  init: (e, n) => new Promise((o, i) => {
49
65
  const l = T(n == null ? void 0 : n.stage);
50
66
  d(l, async (t) => {
51
67
  if (t !== null) {
52
- if (l !== r)
68
+ if (l !== a.production)
53
69
  try {
54
- return await m(e), o(!0);
55
- } catch (a) {
56
- i(a);
70
+ return await f(e), o(!0);
71
+ } catch (r) {
72
+ i(r);
57
73
  }
58
74
  i(t);
75
+ return;
59
76
  }
60
77
  window.TopolPlugin.init(e), o(!0);
61
78
  });
62
79
  }),
80
+ /** Trigger the save callback with current editor content */
63
81
  save: () => {
64
82
  window.TopolPlugin.save();
65
83
  },
84
+ /** Load a template JSON into the editor */
66
85
  load: (e) => {
67
86
  window.TopolPlugin.load(e);
68
87
  },
88
+ /** Toggle the preview mode */
69
89
  togglePreview: () => {
70
90
  window.TopolPlugin.togglePreview();
71
91
  },
92
+ /** Toggle between desktop and mobile preview sizes */
72
93
  togglePreviewSize: () => {
73
94
  window.TopolPlugin.togglePreviewSize();
74
95
  },
96
+ /** Select a file from the custom file manager */
75
97
  chooseFile: (e) => {
76
98
  window.TopolPlugin.chooseFile(e);
77
99
  },
100
+ /** Undo the last action */
78
101
  undo: () => {
79
102
  window.TopolPlugin.undo();
80
103
  },
104
+ /** Redo the last undone action */
81
105
  redo: () => {
82
106
  window.TopolPlugin.redo();
83
107
  },
108
+ /** Destroy the editor instance and clean up resources */
84
109
  destroy: () => {
85
110
  window.TopolPlugin.destroy();
86
111
  },
112
+ /** Update the list of saved/reusable blocks */
87
113
  setSavedBlocks: (e) => {
88
114
  window.TopolPlugin.setSavedBlocks(e);
89
115
  },
116
+ /** Set custom HTML for the preview */
90
117
  setPreviewHTML: (e) => {
91
118
  window.TopolPlugin.setPreviewHTML(e);
92
119
  },
120
+ /** Display a notification in the editor */
93
121
  createNotification: (e) => {
94
122
  window.TopolPlugin.createNotification(e);
95
123
  },
124
+ /** Set the list of active collaboration members */
96
125
  setActiveMembers: (e) => {
97
126
  window.TopolPlugin.setActiveMembers(e);
98
127
  },
128
+ /** Switch to mobile view */
99
129
  changeEmailToMobile: () => {
100
130
  window.TopolPlugin.changeEmailToMobile();
101
131
  },
132
+ /** Switch to desktop view */
102
133
  changeEmailToDesktop: () => {
103
134
  window.TopolPlugin.changeEmailToDesktop();
104
135
  },
136
+ /** Toggle visibility of hidden blocks and structures */
105
137
  toggleBlocksAndStructuresVisibility: () => {
106
138
  window.TopolPlugin.toggleBlocksAndStructuresVisibility();
107
139
  },
140
+ /** Update the content of a custom block */
108
141
  updateCustomBlockContent: (e) => {
109
142
  window.TopolPlugin.updateCustomBlockContent(e);
110
143
  },
144
+ /** Refresh comments/conversations */
111
145
  refreshComments: (e) => {
112
146
  window.TopolPlugin.refreshComments(e);
113
147
  },
148
+ /** Refresh synced rows */
114
149
  refreshSyncedRows: () => {
115
150
  window.TopolPlugin.refreshSyncedRows();
116
151
  },
152
+ /** Open the premade templates selection modal */
117
153
  openPremadeTemplatesSelection: () => {
118
154
  window.TopolPlugin.openPremadeTemplatesSelection();
119
155
  },
156
+ /** Update the API authorization header */
120
157
  updateApiAuthorizationHeader: (e) => {
121
158
  window.TopolPlugin.updateApiAuthorizationHeader(e);
122
159
  },
160
+ /** Set the template name/title */
123
161
  setTemplateName: (e) => {
124
162
  window.TopolPlugin.setTemplateName(e);
125
163
  },
164
+ /** Toggle the AI chat feature */
126
165
  toggleChatAI: () => {
127
166
  window.TopolPlugin.toggleChatAI();
128
167
  },
168
+ /** Toggle the autosaves feature */
129
169
  toggleAutosaves: () => {
130
170
  window.TopolPlugin.toggleAutosaves();
131
171
  },
172
+ /** Toggle the comments panel */
132
173
  toggleComments: () => {
133
174
  window.TopolPlugin.toggleComments();
134
175
  },
176
+ /** Create a new language variant */
135
177
  createLanguage: (e) => {
136
178
  window.TopolPlugin.createLanguage(e);
137
179
  },
180
+ /** Set the primary language */
138
181
  setPrimaryLanguage: (e) => {
139
182
  window.TopolPlugin.setPrimaryLanguage(e);
140
183
  },
184
+ /** Delete a language variant */
141
185
  deleteLanguage: (e) => {
142
186
  window.TopolPlugin.deleteLanguage(e);
143
187
  },
188
+ /** Select/switch to a language */
144
189
  selectLanguage: (e) => {
145
190
  window.TopolPlugin.selectLanguage(e);
146
191
  }
147
- };
192
+ }, h = "https://v1.page-assets.topol.io/topol-lpe.js", E = {
193
+ /**
194
+ * Inits Landing Page Editor.
195
+ *
196
+ * @param options - Configuration options for the editor
197
+ * @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
198
+ * @returns Promise that resolves with the editor instance
199
+ */
200
+ init: (e, n) => new Promise((o, i) => {
201
+ d(h, (l) => {
202
+ if (l !== null) {
203
+ i(l);
204
+ return;
205
+ }
206
+ const t = window.LandingPageEditor(e);
207
+ o(t);
208
+ });
209
+ })
210
+ }, v = m;
148
211
  export {
149
- h as default
212
+ m as EmailEditor,
213
+ E as LandingPageEditor,
214
+ v as TopolPlugin,
215
+ v as default
150
216
  };
@@ -1 +1 @@
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)}}});
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"}})});
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Loads a script from a URL with optional fallback.
3
+ * @param url - Primary URL to load
4
+ * @param fallbackUrl - Optional fallback URL if primary fails
5
+ * @returns Promise that resolves when script is loaded
6
+ */
7
+ export declare function loadScriptWithFallback(url: string, fallbackUrl?: string): Promise<void>;
@@ -0,0 +1,7 @@
1
+ export declare const EMAIL_EDITOR_URLS: {
2
+ readonly production: string;
3
+ readonly dev: string;
4
+ readonly staging: string;
5
+ };
6
+ export declare const EMAIL_EDITOR_PREVIEW_URL_PATTERN = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
7
+ export declare const EMAIL_EDITOR_HTML_ID = "topol-editor";
@@ -0,0 +1,97 @@
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";
6
+ declare global {
7
+ interface Window {
8
+ TopolPlugin: ITopolPlugin;
9
+ }
10
+ }
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
+ */
33
+ 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: () => 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
+ /** Toggle the AI chat feature */
84
+ toggleChatAI: () => void;
85
+ /** Toggle the autosaves feature */
86
+ toggleAutosaves: () => void;
87
+ /** Toggle the comments panel */
88
+ toggleComments: () => void;
89
+ /** Create a new language variant */
90
+ createLanguage: (lang: string) => void;
91
+ /** Set the primary language */
92
+ setPrimaryLanguage: (lang: string) => void;
93
+ /** Delete a language variant */
94
+ deleteLanguage: (lang: string) => void;
95
+ /** Select/switch to a language */
96
+ selectLanguage: (lang: string) => void;
97
+ };
@@ -0,0 +1 @@
1
+ export declare const LANDING_PAGE_EDITOR_URL = "https://v1.page-assets.topol.io/topol-lpe.js";
@@ -0,0 +1,55 @@
1
+ import type ILandingPageOptions from "../../types/landing-page/ILandingPageOptions";
2
+ import type ILandingPageEditorInstance from "../../types/landing-page/ILandingPageEditorInstance";
3
+ import { Stage } from "../../types/Stage";
4
+ type LandingPageEditorFactory = (options: ILandingPageOptions) => ILandingPageEditorInstance;
5
+ declare global {
6
+ interface Window {
7
+ LandingPageEditor: LandingPageEditorFactory;
8
+ }
9
+ }
10
+ export interface LandingPageEditorPluginOptions {
11
+ /**
12
+ * Stage/environment to use. Currently only 'production' is supported for LPE.
13
+ * This is reserved for future staging/dev URL support.
14
+ */
15
+ stage?: Stage;
16
+ }
17
+ /**
18
+ * Landing Page Editor - Create landing pages with drag-and-drop editing.
19
+ *
20
+ * This integration loads the Topol Landing Page Editor into your application.
21
+ * Unlike the Email Editor, this creates an instance that you can interact with.
22
+ *
23
+ * @example
24
+ * ```typescript
25
+ * import { LandingPageEditor } from '@topol.io/editor';
26
+ *
27
+ * const editor = await LandingPageEditor.init({
28
+ * config: {
29
+ * authorize: { apiKey: 'your-key', userId: 'user-123' },
30
+ * },
31
+ * onSave(json, html) { console.log('Saved:', json, html); },
32
+ * onLoaded() { console.log('Editor loaded'); }
33
+ * });
34
+ *
35
+ * // Render the editor into a container
36
+ * editor.render('#landing-page-editor');
37
+ *
38
+ * // Optionally load a template
39
+ * editor.load(templateJson);
40
+ *
41
+ * // Clean up when done
42
+ * editor.destroy();
43
+ * ```
44
+ */
45
+ export declare const LandingPageEditor: {
46
+ /**
47
+ * Inits Landing Page Editor.
48
+ *
49
+ * @param options - Configuration options for the editor
50
+ * @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
51
+ * @returns Promise that resolves with the editor instance
52
+ */
53
+ init: (options: ILandingPageOptions, pluginOptions?: LandingPageEditorPluginOptions) => Promise<ILandingPageEditorInstance>;
54
+ };
55
+ export {};
@@ -0,0 +1,15 @@
1
+ import z from "zod";
2
+ export declare const ContextMessageSchema: z.ZodObject<{
3
+ prompt: z.ZodString;
4
+ answer: z.ZodString;
5
+ }, z.core.$strip>;
6
+ export declare const ContextSchema: z.ZodObject<{
7
+ blockId: z.ZodNullable<z.ZodString>;
8
+ messages: z.ZodArray<z.ZodObject<{
9
+ prompt: z.ZodString;
10
+ answer: z.ZodString;
11
+ }, z.core.$strip>>;
12
+ defaultText: z.ZodString;
13
+ }, z.core.$strip>;
14
+ export type IContextMessage = z.infer<typeof ContextMessageSchema>;
15
+ export type IContext = z.infer<typeof ContextSchema>;
@@ -0,0 +1,33 @@
1
+ import z from "zod";
2
+ export declare const ApiSchema: z.ZodObject<{
3
+ AUTOSAVE: z.ZodOptional<z.ZodString>;
4
+ AUTOSAVES: z.ZodOptional<z.ZodString>;
5
+ GET_AUTOSAVE: z.ZodOptional<z.ZodString>;
6
+ CONVERSATIONS: z.ZodOptional<z.ZodString>;
7
+ COMMENTS: z.ZodOptional<z.ZodString>;
8
+ IMAGE_UPLOAD: z.ZodOptional<z.ZodString>;
9
+ IMAGE_EDITOR_UPLOAD: z.ZodOptional<z.ZodString>;
10
+ FOLDERS: z.ZodOptional<z.ZodString>;
11
+ LOAD: z.ZodOptional<z.ZodString>;
12
+ PREVIEW: z.ZodOptional<z.ZodString>;
13
+ PRODUCTS: z.ZodOptional<z.ZodString>;
14
+ SAVE: z.ZodOptional<z.ZodString>;
15
+ SYNCED_SECTIONS: z.ZodOptional<z.ZodString>;
16
+ SAVED_BLOCKS: z.ZodOptional<z.ZodString>;
17
+ TEST_EMAIL: z.ZodOptional<z.ZodString>;
18
+ PREMADE_TEMPLATES: z.ZodOptional<z.ZodString>;
19
+ PREMADE_TEMPLATE_CATEGORIES: z.ZodOptional<z.ZodString>;
20
+ PREMADE_TEMPLATES_KEYWORDS: z.ZodOptional<z.ZodString>;
21
+ }, z.core.$strip>;
22
+ export declare const LockedApiSchema: z.ZodObject<{
23
+ AUTHORIZE: z.ZodString;
24
+ GCS_SIGNED_URL: z.ZodString;
25
+ GENERATE_CHAT: z.ZodString;
26
+ GENERATE_IMAGE: z.ZodString;
27
+ GENERATE_TEXT: z.ZodString;
28
+ GIPHY_API_KEY: z.ZodString;
29
+ GIPHY_SEARCH: z.ZodString;
30
+ SAVE_SERVER: z.ZodString;
31
+ }, z.core.$strip>;
32
+ export type IAPI = z.infer<typeof ApiSchema>;
33
+ export type ILockedAPI = z.infer<typeof LockedApiSchema>;
@@ -0,0 +1,3 @@
1
+ import z from "zod";
2
+ export declare const AuthHeaderConfigSchema: z.ZodRecord<z.ZodString, z.ZodString>;
3
+ export type IAuthHeaderConfig = z.infer<typeof AuthHeaderConfigSchema>;
@@ -0,0 +1,33 @@
1
+ import z from "zod";
2
+ export declare const AutosaveSchema: z.ZodObject<{
3
+ key: z.ZodString;
4
+ time: z.ZodString;
5
+ uid: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
6
+ created_by: z.ZodCatch<z.ZodOptional<z.ZodObject<{
7
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
8
+ name: z.ZodString;
9
+ profile_photo_url: z.ZodString;
10
+ }, z.core.$strip>>>;
11
+ }, z.core.$strip>;
12
+ export declare const AutosavesSchema: z.ZodArray<z.ZodObject<{
13
+ key: z.ZodString;
14
+ time: z.ZodString;
15
+ uid: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
16
+ created_by: z.ZodCatch<z.ZodOptional<z.ZodObject<{
17
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
18
+ name: z.ZodString;
19
+ profile_photo_url: z.ZodString;
20
+ }, z.core.$strip>>>;
21
+ }, z.core.$strip>>;
22
+ export declare const GroupedAutosavesSchema: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
23
+ key: z.ZodString;
24
+ time: z.ZodString;
25
+ uid: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
26
+ created_by: z.ZodCatch<z.ZodOptional<z.ZodObject<{
27
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
28
+ name: z.ZodString;
29
+ profile_photo_url: z.ZodString;
30
+ }, z.core.$strip>>>;
31
+ }, z.core.$strip>>>;
32
+ export type IAutosaves = z.infer<typeof AutosavesSchema>;
33
+ export type IGroupedAutosaves = z.infer<typeof GroupedAutosavesSchema>;
@@ -0,0 +1,91 @@
1
+ import z from "zod";
2
+ export declare const ReactionSchema: z.ZodObject<{
3
+ created_by: z.ZodObject<{
4
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
5
+ name: z.ZodString;
6
+ profile_photo_url: z.ZodString;
7
+ }, z.core.$strip>;
8
+ type: z.ZodString;
9
+ }, z.core.$strip>;
10
+ export declare const CommentSchema: z.ZodObject<{
11
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
12
+ created_by: z.ZodObject<{
13
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
14
+ name: z.ZodString;
15
+ profile_photo_url: z.ZodString;
16
+ }, z.core.$strip>;
17
+ created_at: z.ZodString;
18
+ read_by: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
19
+ content: z.ZodString;
20
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
21
+ created_by: z.ZodObject<{
22
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
23
+ name: z.ZodString;
24
+ profile_photo_url: z.ZodString;
25
+ }, z.core.$strip>;
26
+ type: z.ZodString;
27
+ }, z.core.$strip>>>;
28
+ }, z.core.$strip>;
29
+ export declare const ConversationSchema: z.ZodObject<{
30
+ comments: z.ZodArray<z.ZodObject<{
31
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
32
+ created_by: z.ZodObject<{
33
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
34
+ name: z.ZodString;
35
+ profile_photo_url: z.ZodString;
36
+ }, z.core.$strip>;
37
+ created_at: z.ZodString;
38
+ read_by: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
39
+ content: z.ZodString;
40
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
41
+ created_by: z.ZodObject<{
42
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
43
+ name: z.ZodString;
44
+ profile_photo_url: z.ZodString;
45
+ }, z.core.$strip>;
46
+ type: z.ZodString;
47
+ }, z.core.$strip>>>;
48
+ }, z.core.$strip>>;
49
+ key: z.ZodString;
50
+ type: z.ZodUnion<readonly [z.ZodLiteral<"block">, z.ZodLiteral<"section">]>;
51
+ involved_users: z.ZodCatch<z.ZodArray<z.ZodObject<{
52
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
53
+ name: z.ZodString;
54
+ profile_photo_url: z.ZodString;
55
+ }, z.core.$strip>>>;
56
+ resolved: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
57
+ delete: z.ZodOptional<z.ZodBoolean>;
58
+ }, z.core.$strip>;
59
+ export declare const ConversationsSchema: z.ZodArray<z.ZodObject<{
60
+ comments: z.ZodArray<z.ZodObject<{
61
+ id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
62
+ created_by: z.ZodObject<{
63
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
64
+ name: z.ZodString;
65
+ profile_photo_url: z.ZodString;
66
+ }, z.core.$strip>;
67
+ created_at: z.ZodString;
68
+ read_by: z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
69
+ content: z.ZodString;
70
+ reactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
71
+ created_by: z.ZodObject<{
72
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
73
+ name: z.ZodString;
74
+ profile_photo_url: z.ZodString;
75
+ }, z.core.$strip>;
76
+ type: z.ZodString;
77
+ }, z.core.$strip>>>;
78
+ }, z.core.$strip>>;
79
+ key: z.ZodString;
80
+ type: z.ZodUnion<readonly [z.ZodLiteral<"block">, z.ZodLiteral<"section">]>;
81
+ involved_users: z.ZodCatch<z.ZodArray<z.ZodObject<{
82
+ user_id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
83
+ name: z.ZodString;
84
+ profile_photo_url: z.ZodString;
85
+ }, z.core.$strip>>>;
86
+ resolved: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodLiteral<0>, z.ZodLiteral<1>]>>;
87
+ delete: z.ZodOptional<z.ZodBoolean>;
88
+ }, z.core.$strip>>;
89
+ export type IReaction = z.infer<typeof ReactionSchema>;
90
+ export type IComment = z.infer<typeof CommentSchema>;
91
+ export type IConversation = z.infer<typeof ConversationSchema>;