@topol.io/editor 1.0.0-alpha.4 → 1.0.0-alpha.6
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/dist/topol-plugin.es.js +95 -86
- package/dist/topol-plugin.umd.js +1 -1
- package/package.json +4 -4
package/dist/topol-plugin.es.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
function
|
|
2
|
-
return
|
|
1
|
+
function g(o) {
|
|
2
|
+
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
3
3
|
}
|
|
4
|
-
var
|
|
5
|
-
var l = document.head || document.getElementsByTagName("head")[0],
|
|
6
|
-
typeof
|
|
7
|
-
},
|
|
8
|
-
var r = "onload" in
|
|
9
|
-
r(
|
|
4
|
+
var c = function(t, e, i) {
|
|
5
|
+
var l = document.head || document.getElementsByTagName("head")[0], n = document.createElement("script");
|
|
6
|
+
typeof e == "function" && (i = e, e = {}), e = e || {}, i = i || function() {
|
|
7
|
+
}, n.type = e.type || "text/javascript", n.charset = e.charset || "utf8", n.async = "async" in e ? !!e.async : !0, n.src = t, e.attrs && w(n, e.attrs), e.text && (n.text = "" + e.text);
|
|
8
|
+
var r = "onload" in n ? s : p;
|
|
9
|
+
r(n, i), n.onload || s(n, i), l.appendChild(n);
|
|
10
10
|
};
|
|
11
|
-
function
|
|
12
|
-
for (var
|
|
13
|
-
|
|
11
|
+
function w(o, t) {
|
|
12
|
+
for (var e in t)
|
|
13
|
+
o.setAttribute(e, t[e]);
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
this.onerror = this.onload = null,
|
|
18
|
-
},
|
|
19
|
-
this.onerror = this.onload = null,
|
|
15
|
+
function s(o, t) {
|
|
16
|
+
o.onload = function() {
|
|
17
|
+
this.onerror = this.onload = null, t(null, o);
|
|
18
|
+
}, o.onerror = function() {
|
|
19
|
+
this.onerror = this.onload = null, t(new Error("Failed to load " + this.src), o);
|
|
20
20
|
};
|
|
21
21
|
}
|
|
22
|
-
function p(
|
|
23
|
-
|
|
24
|
-
this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null,
|
|
22
|
+
function p(o, t) {
|
|
23
|
+
o.onreadystatechange = function() {
|
|
24
|
+
this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, t(null, o));
|
|
25
25
|
};
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
var
|
|
29
|
-
const a = {
|
|
30
|
-
production:
|
|
31
|
-
dev:
|
|
32
|
-
staging:
|
|
33
|
-
},
|
|
34
|
-
function
|
|
35
|
-
switch (
|
|
27
|
+
const u = /* @__PURE__ */ g(c);
|
|
28
|
+
var d = { BASE_URL: "/", MODE: "production", DEV: !1, PROD: !0, SSR: !1 };
|
|
29
|
+
const T = "https://v3.email-assets.topol.io/loader/build.js", P = "https://v3.develop.email-assets.topol.io/loader/build.js", f = "https://v3.develop.email-assets.topol.io/loader/build.js", a = {
|
|
30
|
+
production: d.VITE_TOPOL_URL || T,
|
|
31
|
+
dev: d.VITE_TOPOL_DEV_URL || P,
|
|
32
|
+
staging: d.VITE_TOPOL_STAGING_URL || f
|
|
33
|
+
}, m = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
|
|
34
|
+
function h(o) {
|
|
35
|
+
switch (o) {
|
|
36
36
|
case "dev":
|
|
37
37
|
return a.dev;
|
|
38
38
|
case "staging":
|
|
@@ -40,50 +40,59 @@ function T(e = "production") {
|
|
|
40
40
|
case "production":
|
|
41
41
|
return a.production;
|
|
42
42
|
default:
|
|
43
|
-
return
|
|
43
|
+
return m.replace("{stage}", String(o));
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
function E(o = "production") {
|
|
47
|
+
const t = h(o);
|
|
48
|
+
if (!t) {
|
|
49
|
+
if (a.production)
|
|
50
|
+
return console.error(`[@topol.io/editor] No loader URL resolved for stage "${o}"; falling back to the production loader.`), a.production;
|
|
51
|
+
throw new Error(`[@topol.io/editor] Could not resolve a loader URL for stage "${o}". The editor cannot be loaded.`);
|
|
52
|
+
}
|
|
53
|
+
return t;
|
|
54
|
+
}
|
|
55
|
+
async function v(o) {
|
|
56
|
+
return new Promise((t, e) => {
|
|
57
|
+
u(a.production, (i) => {
|
|
49
58
|
if (i !== null) {
|
|
50
|
-
|
|
59
|
+
e(i);
|
|
51
60
|
return;
|
|
52
61
|
}
|
|
53
|
-
window.TopolPlugin.init(
|
|
62
|
+
window.TopolPlugin.init(o), t(!0);
|
|
54
63
|
});
|
|
55
64
|
});
|
|
56
65
|
}
|
|
57
|
-
const
|
|
66
|
+
const L = {
|
|
58
67
|
/**
|
|
59
68
|
* Initialize the Email Editor.
|
|
60
69
|
* @param topolOptions - Configuration options for the editor
|
|
61
70
|
* @param options - Plugin options including stage selection
|
|
62
71
|
* @returns Promise that resolves to true when the editor is ready
|
|
63
72
|
*/
|
|
64
|
-
init: (
|
|
65
|
-
const l =
|
|
66
|
-
|
|
67
|
-
if (
|
|
73
|
+
init: (o, t) => new Promise((e, i) => {
|
|
74
|
+
const l = E(t == null ? void 0 : t.stage);
|
|
75
|
+
u(l, async (n) => {
|
|
76
|
+
if (n !== null) {
|
|
68
77
|
if (l !== a.production)
|
|
69
78
|
try {
|
|
70
|
-
return await
|
|
79
|
+
return await v(o), e(!0);
|
|
71
80
|
} catch (r) {
|
|
72
81
|
i(r);
|
|
73
82
|
}
|
|
74
|
-
i(
|
|
83
|
+
i(n);
|
|
75
84
|
return;
|
|
76
85
|
}
|
|
77
|
-
window.TopolPlugin.init(
|
|
86
|
+
window.TopolPlugin.init(o), e(!0);
|
|
78
87
|
});
|
|
79
88
|
}),
|
|
80
89
|
/** Trigger the save callback with current editor content */
|
|
81
|
-
save: (
|
|
82
|
-
window.TopolPlugin.save(
|
|
90
|
+
save: (o) => {
|
|
91
|
+
window.TopolPlugin.save(o);
|
|
83
92
|
},
|
|
84
93
|
/** Load a template JSON into the editor */
|
|
85
|
-
load: (
|
|
86
|
-
window.TopolPlugin.load(
|
|
94
|
+
load: (o) => {
|
|
95
|
+
window.TopolPlugin.load(o);
|
|
87
96
|
},
|
|
88
97
|
/** Toggle the preview mode */
|
|
89
98
|
togglePreview: () => {
|
|
@@ -94,8 +103,8 @@ const f = {
|
|
|
94
103
|
window.TopolPlugin.togglePreviewSize();
|
|
95
104
|
},
|
|
96
105
|
/** Select a file from the custom file manager */
|
|
97
|
-
chooseFile: (
|
|
98
|
-
window.TopolPlugin.chooseFile(
|
|
106
|
+
chooseFile: (o) => {
|
|
107
|
+
window.TopolPlugin.chooseFile(o);
|
|
99
108
|
},
|
|
100
109
|
/** Undo the last action */
|
|
101
110
|
undo: () => {
|
|
@@ -110,20 +119,20 @@ const f = {
|
|
|
110
119
|
window.TopolPlugin.destroy();
|
|
111
120
|
},
|
|
112
121
|
/** Update the list of saved/reusable blocks */
|
|
113
|
-
setSavedBlocks: (
|
|
114
|
-
window.TopolPlugin.setSavedBlocks(
|
|
122
|
+
setSavedBlocks: (o) => {
|
|
123
|
+
window.TopolPlugin.setSavedBlocks(o);
|
|
115
124
|
},
|
|
116
125
|
/** Set custom HTML for the preview */
|
|
117
|
-
setPreviewHTML: (
|
|
118
|
-
window.TopolPlugin.setPreviewHTML(
|
|
126
|
+
setPreviewHTML: (o) => {
|
|
127
|
+
window.TopolPlugin.setPreviewHTML(o);
|
|
119
128
|
},
|
|
120
129
|
/** Display a notification in the editor */
|
|
121
|
-
createNotification: (
|
|
122
|
-
window.TopolPlugin.createNotification(
|
|
130
|
+
createNotification: (o) => {
|
|
131
|
+
window.TopolPlugin.createNotification(o);
|
|
123
132
|
},
|
|
124
133
|
/** Set the list of active collaboration members */
|
|
125
|
-
setActiveMembers: (
|
|
126
|
-
window.TopolPlugin.setActiveMembers(
|
|
134
|
+
setActiveMembers: (o) => {
|
|
135
|
+
window.TopolPlugin.setActiveMembers(o);
|
|
127
136
|
},
|
|
128
137
|
/** Switch to mobile view */
|
|
129
138
|
changeEmailToMobile: () => {
|
|
@@ -138,12 +147,12 @@ const f = {
|
|
|
138
147
|
window.TopolPlugin.toggleBlocksAndStructuresVisibility();
|
|
139
148
|
},
|
|
140
149
|
/** Update the content of a custom block */
|
|
141
|
-
updateCustomBlockContent: (
|
|
142
|
-
window.TopolPlugin.updateCustomBlockContent(
|
|
150
|
+
updateCustomBlockContent: (o) => {
|
|
151
|
+
window.TopolPlugin.updateCustomBlockContent(o);
|
|
143
152
|
},
|
|
144
153
|
/** Refresh comments/conversations */
|
|
145
|
-
refreshComments: (
|
|
146
|
-
window.TopolPlugin.refreshComments(
|
|
154
|
+
refreshComments: (o) => {
|
|
155
|
+
window.TopolPlugin.refreshComments(o);
|
|
147
156
|
},
|
|
148
157
|
/** Refresh synced rows */
|
|
149
158
|
refreshSyncedRows: () => {
|
|
@@ -154,15 +163,15 @@ const f = {
|
|
|
154
163
|
window.TopolPlugin.openPremadeTemplatesSelection();
|
|
155
164
|
},
|
|
156
165
|
/** Update the API authorization header */
|
|
157
|
-
updateApiAuthorizationHeader: (
|
|
158
|
-
window.TopolPlugin.updateApiAuthorizationHeader(
|
|
166
|
+
updateApiAuthorizationHeader: (o) => {
|
|
167
|
+
window.TopolPlugin.updateApiAuthorizationHeader(o);
|
|
159
168
|
},
|
|
160
169
|
/** Set the template name/title */
|
|
161
|
-
setTemplateName: (
|
|
162
|
-
window.TopolPlugin.setTemplateName(
|
|
170
|
+
setTemplateName: (o) => {
|
|
171
|
+
window.TopolPlugin.setTemplateName(o);
|
|
163
172
|
},
|
|
164
|
-
updateOptions: (
|
|
165
|
-
window.TopolPlugin.updateOptions(
|
|
173
|
+
updateOptions: (o) => {
|
|
174
|
+
window.TopolPlugin.updateOptions(o);
|
|
166
175
|
},
|
|
167
176
|
/** Toggle the AI chat feature */
|
|
168
177
|
toggleChatAI: () => {
|
|
@@ -177,20 +186,20 @@ const f = {
|
|
|
177
186
|
window.TopolPlugin.toggleComments();
|
|
178
187
|
},
|
|
179
188
|
/** Create a new language variant */
|
|
180
|
-
createLanguage: (
|
|
181
|
-
window.TopolPlugin.createLanguage(
|
|
189
|
+
createLanguage: (o) => {
|
|
190
|
+
window.TopolPlugin.createLanguage(o);
|
|
182
191
|
},
|
|
183
192
|
/** Set the primary language */
|
|
184
|
-
setPrimaryLanguage: (
|
|
185
|
-
window.TopolPlugin.setPrimaryLanguage(
|
|
193
|
+
setPrimaryLanguage: (o) => {
|
|
194
|
+
window.TopolPlugin.setPrimaryLanguage(o);
|
|
186
195
|
},
|
|
187
196
|
/** Delete a language variant */
|
|
188
|
-
deleteLanguage: (
|
|
189
|
-
window.TopolPlugin.deleteLanguage(
|
|
197
|
+
deleteLanguage: (o) => {
|
|
198
|
+
window.TopolPlugin.deleteLanguage(o);
|
|
190
199
|
},
|
|
191
200
|
/** Select/switch to a language */
|
|
192
|
-
selectLanguage: (
|
|
193
|
-
window.TopolPlugin.selectLanguage(
|
|
201
|
+
selectLanguage: (o) => {
|
|
202
|
+
window.TopolPlugin.selectLanguage(o);
|
|
194
203
|
},
|
|
195
204
|
/** Get the list of mutations */
|
|
196
205
|
getMutations: () => window.TopolPlugin.getMutations(),
|
|
@@ -199,14 +208,14 @@ const f = {
|
|
|
199
208
|
window.TopolPlugin.toggleControlPanel();
|
|
200
209
|
},
|
|
201
210
|
/** Update the editor template with new JSON data */
|
|
202
|
-
updateTemplate: (
|
|
203
|
-
window.TopolPlugin.updateTemplate(
|
|
211
|
+
updateTemplate: (o, t) => {
|
|
212
|
+
window.TopolPlugin.updateTemplate(o, t);
|
|
204
213
|
},
|
|
205
214
|
/** Toggle dark mode for the editor */
|
|
206
215
|
toggleDarkMode: () => {
|
|
207
216
|
window.TopolPlugin.toggleDarkMode();
|
|
208
217
|
}
|
|
209
|
-
},
|
|
218
|
+
}, _ = "https://v1.page-assets.topol.io/topol-lpe.js", A = {
|
|
210
219
|
/**
|
|
211
220
|
* Inits Landing Page Editor.
|
|
212
221
|
*
|
|
@@ -214,20 +223,20 @@ const f = {
|
|
|
214
223
|
* @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
|
|
215
224
|
* @returns Promise that resolves with the editor instance
|
|
216
225
|
*/
|
|
217
|
-
init: (
|
|
218
|
-
|
|
226
|
+
init: (o, t) => new Promise((e, i) => {
|
|
227
|
+
u(_, (l) => {
|
|
219
228
|
if (l !== null) {
|
|
220
229
|
i(l);
|
|
221
230
|
return;
|
|
222
231
|
}
|
|
223
|
-
const
|
|
224
|
-
|
|
232
|
+
const n = window.LandingPageEditor(o);
|
|
233
|
+
e(n);
|
|
225
234
|
});
|
|
226
235
|
})
|
|
227
|
-
},
|
|
236
|
+
}, y = L;
|
|
228
237
|
export {
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
238
|
+
L as EmailEditor,
|
|
239
|
+
A as LandingPageEditor,
|
|
240
|
+
y as TopolPlugin,
|
|
241
|
+
y as default
|
|
233
242
|
};
|
package/dist/topol-plugin.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(l,
|
|
1
|
+
(function(l,d){typeof exports=="object"&&typeof module<"u"?d(exports):typeof define=="function"&&define.amd?define(["exports"],d):(l=typeof globalThis<"u"?globalThis:l||self,d(l["topol-plugin"]={}))})(this,function(l){"use strict";function d(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var T=function(t,e,i){var r=document.head||document.getElementsByTagName("head")[0],n=document.createElement("script");typeof e=="function"&&(i=e,e={}),e=e||{},i=i||function(){},n.type=e.type||"text/javascript",n.charset=e.charset||"utf8",n.async="async"in e?!!e.async:!0,n.src=t,e.attrs&&P(n,e.attrs),e.text&&(n.text=""+e.text);var g="onload"in n?c:f;g(n,i),n.onload||c(n,i),r.appendChild(n)};function P(o,t){for(var e in t)o.setAttribute(e,t[e])}function c(o,t){o.onload=function(){this.onerror=this.onload=null,t(null,o)},o.onerror=function(){this.onerror=this.onload=null,t(new Error("Failed to load "+this.src),o)}}function f(o,t){o.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,t(null,o))}}const u=d(T);var s={BASE_URL:"/",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const a={production:s.VITE_TOPOL_URL||"https://v3.email-assets.topol.io/loader/build.js",dev:s.VITE_TOPOL_DEV_URL||"https://v3.develop.email-assets.topol.io/loader/build.js",staging:s.VITE_TOPOL_STAGING_URL||"https://v3.develop.email-assets.topol.io/loader/build.js"},m="https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";function E(o){switch(o){case"dev":return a.dev;case"staging":return a.staging;case"production":return a.production;default:return m.replace("{stage}",String(o))}}function h(o="production"){const t=E(o);if(!t){if(a.production)return console.error(`[@topol.io/editor] No loader URL resolved for stage "${o}"; falling back to the production loader.`),a.production;throw new Error(`[@topol.io/editor] Could not resolve a loader URL for stage "${o}". The editor cannot be loaded.`)}return t}async function L(o){return new Promise((t,e)=>{u(a.production,i=>{if(i!==null){e(i);return}window.TopolPlugin.init(o),t(!0)})})}const p={init:(o,t)=>new Promise((e,i)=>{const r=h(t==null?void 0:t.stage);u(r,async n=>{if(n!==null){if(r!==a.production)try{return await L(o),e(!0)}catch(g){i(g)}i(n);return}window.TopolPlugin.init(o),e(!0)})}),save:o=>{window.TopolPlugin.save(o)},load:o=>{window.TopolPlugin.load(o)},togglePreview:()=>{window.TopolPlugin.togglePreview()},togglePreviewSize:()=>{window.TopolPlugin.togglePreviewSize()},chooseFile:o=>{window.TopolPlugin.chooseFile(o)},undo:()=>{window.TopolPlugin.undo()},redo:()=>{window.TopolPlugin.redo()},destroy:()=>{window.TopolPlugin.destroy()},setSavedBlocks:o=>{window.TopolPlugin.setSavedBlocks(o)},setPreviewHTML:o=>{window.TopolPlugin.setPreviewHTML(o)},createNotification:o=>{window.TopolPlugin.createNotification(o)},setActiveMembers:o=>{window.TopolPlugin.setActiveMembers(o)},changeEmailToMobile:()=>{window.TopolPlugin.changeEmailToMobile()},changeEmailToDesktop:()=>{window.TopolPlugin.changeEmailToDesktop()},toggleBlocksAndStructuresVisibility:()=>{window.TopolPlugin.toggleBlocksAndStructuresVisibility()},updateCustomBlockContent:o=>{window.TopolPlugin.updateCustomBlockContent(o)},refreshComments:o=>{window.TopolPlugin.refreshComments(o)},refreshSyncedRows:()=>{window.TopolPlugin.refreshSyncedRows()},openPremadeTemplatesSelection:()=>{window.TopolPlugin.openPremadeTemplatesSelection()},updateApiAuthorizationHeader:o=>{window.TopolPlugin.updateApiAuthorizationHeader(o)},setTemplateName:o=>{window.TopolPlugin.setTemplateName(o)},updateOptions:o=>{window.TopolPlugin.updateOptions(o)},toggleChatAI:()=>{window.TopolPlugin.toggleChatAI()},toggleAutosaves:()=>{window.TopolPlugin.toggleAutosaves()},toggleComments:()=>{window.TopolPlugin.toggleComments()},createLanguage:o=>{window.TopolPlugin.createLanguage(o)},setPrimaryLanguage:o=>{window.TopolPlugin.setPrimaryLanguage(o)},deleteLanguage:o=>{window.TopolPlugin.deleteLanguage(o)},selectLanguage:o=>{window.TopolPlugin.selectLanguage(o)},getMutations:()=>window.TopolPlugin.getMutations(),toggleControlPanel:()=>{window.TopolPlugin.toggleControlPanel()},updateTemplate:(o,t)=>{window.TopolPlugin.updateTemplate(o,t)},toggleDarkMode:()=>{window.TopolPlugin.toggleDarkMode()}},_="https://v1.page-assets.topol.io/topol-lpe.js",v={init:(o,t)=>new Promise((e,i)=>{u(_,r=>{if(r!==null){i(r);return}const n=window.LandingPageEditor(o);e(n)})})},w=p;l.EmailEditor=p,l.LandingPageEditor=v,l.TopolPlugin=w,l.default=w,Object.defineProperties(l,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
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.
|
|
15
|
+
"version": "1.0.0-alpha.6",
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
"prettier": "3.1.1",
|
|
37
37
|
"typescript": "^5.2.2",
|
|
38
38
|
"vite": "^5.0.11",
|
|
39
|
-
"vitest": "^4.0.16"
|
|
40
|
-
"zod": "^4.3.5"
|
|
39
|
+
"vitest": "^4.0.16"
|
|
41
40
|
},
|
|
42
41
|
"dependencies": {
|
|
43
|
-
"load-script": "^2.0.0"
|
|
42
|
+
"load-script": "^2.0.0",
|
|
43
|
+
"zod": "^4.3.5"
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
46
|
"access": "public"
|