@topol.io/editor-react 0.3.0 → 1.0.0-alpha.1
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/LICENSE +1 -1
- package/dist/topol-editor-react.es.js +282 -521
- package/dist/topol-editor-react.umd.js +1 -31
- package/dist/types/{src/TopolEditor.d.ts → EmailEditor.d.ts} +7 -8
- package/dist/types/LandingPageEditor.d.ts +41 -0
- package/dist/types/TopolEditor.d.ts +3 -0
- package/dist/types/entry.d.ts +48 -0
- package/dist/types/types.d.ts +19 -0
- package/package.json +15 -6
- package/dist/types/types/IReactTopolOptions.d.ts +0 -2
package/LICENSE
CHANGED
|
@@ -1,671 +1,432 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @license React
|
|
5
|
-
* react-jsx-runtime.production.js
|
|
6
|
-
*
|
|
7
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the MIT license found in the
|
|
10
|
-
* LICENSE file in the root directory of this source tree.
|
|
11
|
-
*/
|
|
12
|
-
var ge;
|
|
13
|
-
function je() {
|
|
14
|
-
if (ge) return k;
|
|
15
|
-
ge = 1;
|
|
16
|
-
var o = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
|
|
17
|
-
function c(r, i, f) {
|
|
18
|
-
var v = null;
|
|
19
|
-
if (f !== void 0 && (v = "" + f), i.key !== void 0 && (v = "" + i.key), "key" in i) {
|
|
20
|
-
f = {};
|
|
21
|
-
for (var y in i)
|
|
22
|
-
y !== "key" && (f[y] = i[y]);
|
|
23
|
-
} else f = i;
|
|
24
|
-
return i = f.ref, {
|
|
25
|
-
$$typeof: o,
|
|
26
|
-
type: r,
|
|
27
|
-
key: v,
|
|
28
|
-
ref: i !== void 0 ? i : null,
|
|
29
|
-
props: f
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
return k.Fragment = l, k.jsx = c, k.jsxs = c, k;
|
|
33
|
-
}
|
|
34
|
-
var A = {};
|
|
35
|
-
/**
|
|
36
|
-
* @license React
|
|
37
|
-
* react-jsx-runtime.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/
|
|
44
|
-
var ve;
|
|
45
|
-
function Ne() {
|
|
46
|
-
return ve || (ve = 1, process.env.NODE_ENV !== "production" && function() {
|
|
47
|
-
function o(e) {
|
|
48
|
-
if (e == null) return null;
|
|
49
|
-
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof === Re ? null : e.displayName || e.name || null;
|
|
51
|
-
if (typeof e == "string") return e;
|
|
52
|
-
switch (e) {
|
|
53
|
-
case N:
|
|
54
|
-
return "Fragment";
|
|
55
|
-
case ke:
|
|
56
|
-
return "Portal";
|
|
57
|
-
case Z:
|
|
58
|
-
return "Profiler";
|
|
59
|
-
case X:
|
|
60
|
-
return "StrictMode";
|
|
61
|
-
case B:
|
|
62
|
-
return "Suspense";
|
|
63
|
-
case Y:
|
|
64
|
-
return "SuspenseList";
|
|
65
|
-
}
|
|
66
|
-
if (typeof e == "object")
|
|
67
|
-
switch (typeof e.tag == "number" && console.error(
|
|
68
|
-
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
|
-
), e.$$typeof) {
|
|
70
|
-
case K:
|
|
71
|
-
return (e.displayName || "Context") + ".Provider";
|
|
72
|
-
case Q:
|
|
73
|
-
return (e._context.displayName || "Context") + ".Consumer";
|
|
74
|
-
case M:
|
|
75
|
-
var t = e.render;
|
|
76
|
-
return e = e.displayName, e || (e = t.displayName || t.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
77
|
-
case W:
|
|
78
|
-
return t = e.displayName || null, t !== null ? t : o(e.type) || "Memo";
|
|
79
|
-
case $:
|
|
80
|
-
t = e._payload, e = e._init;
|
|
81
|
-
try {
|
|
82
|
-
return o(e(t));
|
|
83
|
-
} catch {
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
}
|
|
88
|
-
function l(e) {
|
|
89
|
-
return "" + e;
|
|
90
|
-
}
|
|
91
|
-
function c(e) {
|
|
92
|
-
try {
|
|
93
|
-
l(e);
|
|
94
|
-
var t = !1;
|
|
95
|
-
} catch {
|
|
96
|
-
t = !0;
|
|
97
|
-
}
|
|
98
|
-
if (t) {
|
|
99
|
-
t = console;
|
|
100
|
-
var n = t.error, u = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
101
|
-
return n.call(
|
|
102
|
-
t,
|
|
103
|
-
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
104
|
-
u
|
|
105
|
-
), l(e);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
function r() {
|
|
109
|
-
}
|
|
110
|
-
function i() {
|
|
111
|
-
if (P === 0) {
|
|
112
|
-
oe = console.log, te = console.info, ne = console.warn, re = console.error, ae = console.group, ie = console.groupCollapsed, le = console.groupEnd;
|
|
113
|
-
var e = {
|
|
114
|
-
configurable: !0,
|
|
115
|
-
enumerable: !0,
|
|
116
|
-
value: r,
|
|
117
|
-
writable: !0
|
|
118
|
-
};
|
|
119
|
-
Object.defineProperties(console, {
|
|
120
|
-
info: e,
|
|
121
|
-
log: e,
|
|
122
|
-
warn: e,
|
|
123
|
-
error: e,
|
|
124
|
-
group: e,
|
|
125
|
-
groupCollapsed: e,
|
|
126
|
-
groupEnd: e
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
P++;
|
|
130
|
-
}
|
|
131
|
-
function f() {
|
|
132
|
-
if (P--, P === 0) {
|
|
133
|
-
var e = { configurable: !0, enumerable: !0, writable: !0 };
|
|
134
|
-
Object.defineProperties(console, {
|
|
135
|
-
log: b({}, e, { value: oe }),
|
|
136
|
-
info: b({}, e, { value: te }),
|
|
137
|
-
warn: b({}, e, { value: ne }),
|
|
138
|
-
error: b({}, e, { value: re }),
|
|
139
|
-
group: b({}, e, { value: ae }),
|
|
140
|
-
groupCollapsed: b({}, e, { value: ie }),
|
|
141
|
-
groupEnd: b({}, e, { value: le })
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
0 > P && console.error(
|
|
145
|
-
"disabledDepth fell below zero. This is a bug in React. Please file an issue."
|
|
146
|
-
);
|
|
147
|
-
}
|
|
148
|
-
function v(e) {
|
|
149
|
-
if (U === void 0)
|
|
150
|
-
try {
|
|
151
|
-
throw Error();
|
|
152
|
-
} catch (n) {
|
|
153
|
-
var t = n.stack.trim().match(/\n( *(at )?)/);
|
|
154
|
-
U = t && t[1] || "", ue = -1 < n.stack.indexOf(`
|
|
155
|
-
at`) ? " (<anonymous>)" : -1 < n.stack.indexOf("@") ? "@unknown:0:0" : "";
|
|
156
|
-
}
|
|
157
|
-
return `
|
|
158
|
-
` + U + e + ue;
|
|
159
|
-
}
|
|
160
|
-
function y(e, t) {
|
|
161
|
-
if (!e || z) return "";
|
|
162
|
-
var n = H.get(e);
|
|
163
|
-
if (n !== void 0) return n;
|
|
164
|
-
z = !0, n = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
|
|
165
|
-
var u = null;
|
|
166
|
-
u = T.H, T.H = null, i();
|
|
167
|
-
try {
|
|
168
|
-
var d = {
|
|
169
|
-
DetermineComponentFrameRoot: function() {
|
|
170
|
-
try {
|
|
171
|
-
if (t) {
|
|
172
|
-
var E = function() {
|
|
173
|
-
throw Error();
|
|
174
|
-
};
|
|
175
|
-
if (Object.defineProperty(E.prototype, "props", {
|
|
176
|
-
set: function() {
|
|
177
|
-
throw Error();
|
|
178
|
-
}
|
|
179
|
-
}), typeof Reflect == "object" && Reflect.construct) {
|
|
180
|
-
try {
|
|
181
|
-
Reflect.construct(E, []);
|
|
182
|
-
} catch (w) {
|
|
183
|
-
var R = w;
|
|
184
|
-
}
|
|
185
|
-
Reflect.construct(e, [], E);
|
|
186
|
-
} else {
|
|
187
|
-
try {
|
|
188
|
-
E.call();
|
|
189
|
-
} catch (w) {
|
|
190
|
-
R = w;
|
|
191
|
-
}
|
|
192
|
-
e.call(E.prototype);
|
|
193
|
-
}
|
|
194
|
-
} else {
|
|
195
|
-
try {
|
|
196
|
-
throw Error();
|
|
197
|
-
} catch (w) {
|
|
198
|
-
R = w;
|
|
199
|
-
}
|
|
200
|
-
(E = e()) && typeof E.catch == "function" && E.catch(function() {
|
|
201
|
-
});
|
|
202
|
-
}
|
|
203
|
-
} catch (w) {
|
|
204
|
-
if (w && R && typeof w.stack == "string")
|
|
205
|
-
return [w.stack, R.stack];
|
|
206
|
-
}
|
|
207
|
-
return [null, null];
|
|
208
|
-
}
|
|
209
|
-
};
|
|
210
|
-
d.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
|
|
211
|
-
var s = Object.getOwnPropertyDescriptor(
|
|
212
|
-
d.DetermineComponentFrameRoot,
|
|
213
|
-
"name"
|
|
214
|
-
);
|
|
215
|
-
s && s.configurable && Object.defineProperty(
|
|
216
|
-
d.DetermineComponentFrameRoot,
|
|
217
|
-
"name",
|
|
218
|
-
{ value: "DetermineComponentFrameRoot" }
|
|
219
|
-
);
|
|
220
|
-
var a = d.DetermineComponentFrameRoot(), m = a[0], C = a[1];
|
|
221
|
-
if (m && C) {
|
|
222
|
-
var g = m.split(`
|
|
223
|
-
`), h = C.split(`
|
|
224
|
-
`);
|
|
225
|
-
for (a = s = 0; s < g.length && !g[s].includes(
|
|
226
|
-
"DetermineComponentFrameRoot"
|
|
227
|
-
); )
|
|
228
|
-
s++;
|
|
229
|
-
for (; a < h.length && !h[a].includes(
|
|
230
|
-
"DetermineComponentFrameRoot"
|
|
231
|
-
); )
|
|
232
|
-
a++;
|
|
233
|
-
if (s === g.length || a === h.length)
|
|
234
|
-
for (s = g.length - 1, a = h.length - 1; 1 <= s && 0 <= a && g[s] !== h[a]; )
|
|
235
|
-
a--;
|
|
236
|
-
for (; 1 <= s && 0 <= a; s--, a--)
|
|
237
|
-
if (g[s] !== h[a]) {
|
|
238
|
-
if (s !== 1 || a !== 1)
|
|
239
|
-
do
|
|
240
|
-
if (s--, a--, 0 > a || g[s] !== h[a]) {
|
|
241
|
-
var S = `
|
|
242
|
-
` + g[s].replace(
|
|
243
|
-
" at new ",
|
|
244
|
-
" at "
|
|
245
|
-
);
|
|
246
|
-
return e.displayName && S.includes("<anonymous>") && (S = S.replace("<anonymous>", e.displayName)), typeof e == "function" && H.set(e, S), S;
|
|
247
|
-
}
|
|
248
|
-
while (1 <= s && 0 <= a);
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
} finally {
|
|
253
|
-
z = !1, T.H = u, f(), Error.prepareStackTrace = n;
|
|
254
|
-
}
|
|
255
|
-
return g = (g = e ? e.displayName || e.name : "") ? v(g) : "", typeof e == "function" && H.set(e, g), g;
|
|
256
|
-
}
|
|
257
|
-
function p(e) {
|
|
258
|
-
if (e == null) return "";
|
|
259
|
-
if (typeof e == "function") {
|
|
260
|
-
var t = e.prototype;
|
|
261
|
-
return y(
|
|
262
|
-
e,
|
|
263
|
-
!(!t || !t.isReactComponent)
|
|
264
|
-
);
|
|
265
|
-
}
|
|
266
|
-
if (typeof e == "string") return v(e);
|
|
267
|
-
switch (e) {
|
|
268
|
-
case B:
|
|
269
|
-
return v("Suspense");
|
|
270
|
-
case Y:
|
|
271
|
-
return v("SuspenseList");
|
|
272
|
-
}
|
|
273
|
-
if (typeof e == "object")
|
|
274
|
-
switch (e.$$typeof) {
|
|
275
|
-
case M:
|
|
276
|
-
return e = y(e.render, !1), e;
|
|
277
|
-
case W:
|
|
278
|
-
return p(e.type);
|
|
279
|
-
case $:
|
|
280
|
-
t = e._payload, e = e._init;
|
|
281
|
-
try {
|
|
282
|
-
return p(e(t));
|
|
283
|
-
} catch {
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
return "";
|
|
287
|
-
}
|
|
288
|
-
function x() {
|
|
289
|
-
var e = T.A;
|
|
290
|
-
return e === null ? null : e.getOwner();
|
|
291
|
-
}
|
|
292
|
-
function be(e) {
|
|
293
|
-
if (ee.call(e, "key")) {
|
|
294
|
-
var t = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
295
|
-
if (t && t.isReactWarning) return !1;
|
|
296
|
-
}
|
|
297
|
-
return e.key !== void 0;
|
|
298
|
-
}
|
|
299
|
-
function he(e, t) {
|
|
300
|
-
function n() {
|
|
301
|
-
se || (se = !0, console.error(
|
|
302
|
-
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
303
|
-
t
|
|
304
|
-
));
|
|
305
|
-
}
|
|
306
|
-
n.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
307
|
-
get: n,
|
|
308
|
-
configurable: !0
|
|
309
|
-
});
|
|
310
|
-
}
|
|
311
|
-
function ye() {
|
|
312
|
-
var e = o(this.type);
|
|
313
|
-
return ce[e] || (ce[e] = !0, console.error(
|
|
314
|
-
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
315
|
-
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
316
|
-
}
|
|
317
|
-
function Ce(e, t, n, u, d, s) {
|
|
318
|
-
return n = s.ref, e = {
|
|
319
|
-
$$typeof: j,
|
|
320
|
-
type: e,
|
|
321
|
-
key: t,
|
|
322
|
-
props: s,
|
|
323
|
-
_owner: d
|
|
324
|
-
}, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
|
|
325
|
-
enumerable: !1,
|
|
326
|
-
get: ye
|
|
327
|
-
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
328
|
-
configurable: !1,
|
|
329
|
-
enumerable: !1,
|
|
330
|
-
writable: !0,
|
|
331
|
-
value: 0
|
|
332
|
-
}), Object.defineProperty(e, "_debugInfo", {
|
|
333
|
-
configurable: !1,
|
|
334
|
-
enumerable: !1,
|
|
335
|
-
writable: !0,
|
|
336
|
-
value: null
|
|
337
|
-
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
338
|
-
}
|
|
339
|
-
function I(e, t, n, u, d, s) {
|
|
340
|
-
if (typeof e == "string" || typeof e == "function" || e === N || e === Z || e === X || e === B || e === Y || e === Ae || typeof e == "object" && e !== null && (e.$$typeof === $ || e.$$typeof === W || e.$$typeof === K || e.$$typeof === Q || e.$$typeof === M || e.$$typeof === _e || e.getModuleId !== void 0)) {
|
|
341
|
-
var a = t.children;
|
|
342
|
-
if (a !== void 0)
|
|
343
|
-
if (u)
|
|
344
|
-
if (L(a)) {
|
|
345
|
-
for (u = 0; u < a.length; u++)
|
|
346
|
-
J(a[u], e);
|
|
347
|
-
Object.freeze && Object.freeze(a);
|
|
348
|
-
} else
|
|
349
|
-
console.error(
|
|
350
|
-
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
351
|
-
);
|
|
352
|
-
else J(a, e);
|
|
353
|
-
} else
|
|
354
|
-
a = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (a += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? u = "null" : L(e) ? u = "array" : e !== void 0 && e.$$typeof === j ? (u = "<" + (o(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, console.error(
|
|
355
|
-
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
|
|
356
|
-
u,
|
|
357
|
-
a
|
|
358
|
-
);
|
|
359
|
-
if (ee.call(t, "key")) {
|
|
360
|
-
a = o(e);
|
|
361
|
-
var m = Object.keys(t).filter(function(g) {
|
|
362
|
-
return g !== "key";
|
|
363
|
-
});
|
|
364
|
-
u = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", fe[a + u] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
365
|
-
`A props object containing a "key" prop is being spread into JSX:
|
|
366
|
-
let props = %s;
|
|
367
|
-
<%s {...props} />
|
|
368
|
-
React keys must be passed directly to JSX without using spread:
|
|
369
|
-
let props = %s;
|
|
370
|
-
<%s key={someKey} {...props} />`,
|
|
371
|
-
u,
|
|
372
|
-
a,
|
|
373
|
-
m,
|
|
374
|
-
a
|
|
375
|
-
), fe[a + u] = !0);
|
|
376
|
-
}
|
|
377
|
-
if (a = null, n !== void 0 && (c(n), a = "" + n), be(t) && (c(t.key), a = "" + t.key), "key" in t) {
|
|
378
|
-
n = {};
|
|
379
|
-
for (var C in t)
|
|
380
|
-
C !== "key" && (n[C] = t[C]);
|
|
381
|
-
} else n = t;
|
|
382
|
-
return a && he(
|
|
383
|
-
n,
|
|
384
|
-
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
385
|
-
), Ce(e, a, s, d, x(), n);
|
|
386
|
-
}
|
|
387
|
-
function J(e, t) {
|
|
388
|
-
if (typeof e == "object" && e && e.$$typeof !== pe) {
|
|
389
|
-
if (L(e))
|
|
390
|
-
for (var n = 0; n < e.length; n++) {
|
|
391
|
-
var u = e[n];
|
|
392
|
-
O(u) && G(u, t);
|
|
393
|
-
}
|
|
394
|
-
else if (O(e))
|
|
395
|
-
e._store && (e._store.validated = 1);
|
|
396
|
-
else if (e === null || typeof e != "object" ? n = null : (n = D && e[D] || e["@@iterator"], n = typeof n == "function" ? n : null), typeof n == "function" && n !== e.entries && (n = n.call(e), n !== e))
|
|
397
|
-
for (; !(e = n.next()).done; )
|
|
398
|
-
O(e.value) && G(e.value, t);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function O(e) {
|
|
402
|
-
return typeof e == "object" && e !== null && e.$$typeof === j;
|
|
403
|
-
}
|
|
404
|
-
function G(e, t) {
|
|
405
|
-
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, t = Pe(t), !de[t])) {
|
|
406
|
-
de[t] = !0;
|
|
407
|
-
var n = "";
|
|
408
|
-
e && e._owner != null && e._owner !== x() && (n = null, typeof e._owner.tag == "number" ? n = o(e._owner.type) : typeof e._owner.name == "string" && (n = e._owner.name), n = " It was passed a child from " + n + ".");
|
|
409
|
-
var u = T.getCurrentStack;
|
|
410
|
-
T.getCurrentStack = function() {
|
|
411
|
-
var d = p(e.type);
|
|
412
|
-
return u && (d += u() || ""), d;
|
|
413
|
-
}, console.error(
|
|
414
|
-
'Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',
|
|
415
|
-
t,
|
|
416
|
-
n
|
|
417
|
-
), T.getCurrentStack = u;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function Pe(e) {
|
|
421
|
-
var t = "", n = x();
|
|
422
|
-
return n && (n = o(n.type)) && (t = `
|
|
423
|
-
|
|
424
|
-
Check the render method of \`` + n + "`."), t || (e = o(e)) && (t = `
|
|
425
|
-
|
|
426
|
-
Check the top-level render call using <` + e + ">."), t;
|
|
427
|
-
}
|
|
428
|
-
var Se = xe, j = Symbol.for("react.transitional.element"), ke = Symbol.for("react.portal"), N = Symbol.for("react.fragment"), X = Symbol.for("react.strict_mode"), Z = Symbol.for("react.profiler"), Q = Symbol.for("react.consumer"), K = Symbol.for("react.context"), M = Symbol.for("react.forward_ref"), B = Symbol.for("react.suspense"), Y = Symbol.for("react.suspense_list"), W = Symbol.for("react.memo"), $ = Symbol.for("react.lazy"), Ae = Symbol.for("react.offscreen"), D = Symbol.iterator, Re = Symbol.for("react.client.reference"), T = Se.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, b = Object.assign, _e = Symbol.for("react.client.reference"), L = Array.isArray, P = 0, oe, te, ne, re, ae, ie, le;
|
|
429
|
-
r.__reactDisabledLog = !0;
|
|
430
|
-
var U, ue, z = !1, H = new (typeof WeakMap == "function" ? WeakMap : Map)(), pe = Symbol.for("react.client.reference"), se, ce = {}, fe = {}, de = {};
|
|
431
|
-
A.Fragment = N, A.jsx = function(e, t, n, u, d) {
|
|
432
|
-
return I(e, t, n, !1, u, d);
|
|
433
|
-
}, A.jsxs = function(e, t, n, u, d) {
|
|
434
|
-
return I(e, t, n, !0, u, d);
|
|
435
|
-
};
|
|
436
|
-
}()), A;
|
|
437
|
-
}
|
|
438
|
-
var me;
|
|
439
|
-
function Me() {
|
|
440
|
-
return me || (me = 1, process.env.NODE_ENV === "production" ? _.exports = je() : _.exports = Ne()), _.exports;
|
|
441
|
-
}
|
|
442
|
-
var Be = Me();
|
|
443
|
-
function Ye(o) {
|
|
1
|
+
import { jsx as P } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as p, useEffect as v, forwardRef as y, useImperativeHandle as S } from "react";
|
|
3
|
+
function k(o) {
|
|
444
4
|
return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
|
|
445
5
|
}
|
|
446
|
-
var
|
|
447
|
-
var
|
|
6
|
+
var B = function(o, l, c) {
|
|
7
|
+
var a = document.head || document.getElementsByTagName("head")[0], r = document.createElement("script");
|
|
448
8
|
typeof l == "function" && (c = l, l = {}), l = l || {}, c = c || function() {
|
|
449
|
-
},
|
|
450
|
-
var
|
|
451
|
-
|
|
9
|
+
}, r.type = l.type || "text/javascript", r.charset = l.charset || "utf8", r.async = "async" in l ? !!l.async : !0, r.src = o, l.attrs && L(r, l.attrs), l.text && (r.text = "" + l.text);
|
|
10
|
+
var u = "onload" in r ? E : R;
|
|
11
|
+
u(r, c), r.onload || E(r, c), a.appendChild(r);
|
|
452
12
|
};
|
|
453
|
-
function
|
|
13
|
+
function L(o, l) {
|
|
454
14
|
for (var c in l)
|
|
455
15
|
o.setAttribute(c, l[c]);
|
|
456
16
|
}
|
|
457
|
-
function
|
|
17
|
+
function E(o, l) {
|
|
458
18
|
o.onload = function() {
|
|
459
19
|
this.onerror = this.onload = null, l(null, o);
|
|
460
20
|
}, o.onerror = function() {
|
|
461
21
|
this.onerror = this.onload = null, l(new Error("Failed to load " + this.src), o);
|
|
462
22
|
};
|
|
463
23
|
}
|
|
464
|
-
function
|
|
24
|
+
function R(o, l) {
|
|
465
25
|
o.onreadystatechange = function() {
|
|
466
26
|
this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, l(null, o));
|
|
467
27
|
};
|
|
468
28
|
}
|
|
469
|
-
const
|
|
470
|
-
|
|
29
|
+
const f = /* @__PURE__ */ k(B);
|
|
30
|
+
var m = {};
|
|
31
|
+
const w = {
|
|
32
|
+
production: m.VITE_TOPOL_URL,
|
|
33
|
+
dev: m.VITE_TOPOL_DEV_URL,
|
|
34
|
+
staging: m.VITE_TOPOL_STAGING_URL
|
|
35
|
+
}, A = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
|
|
36
|
+
function I(o = "production") {
|
|
471
37
|
switch (o) {
|
|
472
38
|
case "dev":
|
|
473
|
-
return
|
|
39
|
+
return w.dev;
|
|
474
40
|
case "staging":
|
|
475
|
-
return
|
|
41
|
+
return w.staging;
|
|
476
42
|
case "production":
|
|
477
|
-
return
|
|
43
|
+
return w.production;
|
|
478
44
|
default:
|
|
479
|
-
return
|
|
45
|
+
return A.replace("{stage}", String(o));
|
|
480
46
|
}
|
|
481
47
|
}
|
|
482
|
-
async function
|
|
48
|
+
async function O(o) {
|
|
483
49
|
return new Promise((l, c) => {
|
|
484
|
-
|
|
485
|
-
|
|
50
|
+
f(w.production, (a) => {
|
|
51
|
+
if (a !== null) {
|
|
52
|
+
c(a);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
window.TopolPlugin.init(o), l(!0);
|
|
486
56
|
});
|
|
487
57
|
});
|
|
488
58
|
}
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
59
|
+
const h = {
|
|
60
|
+
/**
|
|
61
|
+
* Initialize the Email Editor.
|
|
62
|
+
* @param topolOptions - Configuration options for the editor
|
|
63
|
+
* @param options - Plugin options including stage selection
|
|
64
|
+
* @returns Promise that resolves to true when the editor is ready
|
|
65
|
+
*/
|
|
66
|
+
init: (o, l) => new Promise((c, a) => {
|
|
67
|
+
const r = I(l == null ? void 0 : l.stage);
|
|
68
|
+
f(r, async (u) => {
|
|
69
|
+
if (u !== null) {
|
|
70
|
+
if (r !== w.production)
|
|
495
71
|
try {
|
|
496
|
-
return await
|
|
497
|
-
} catch (
|
|
498
|
-
|
|
72
|
+
return await O(o), c(!0);
|
|
73
|
+
} catch (d) {
|
|
74
|
+
a(d);
|
|
499
75
|
}
|
|
500
|
-
|
|
76
|
+
a(u);
|
|
77
|
+
return;
|
|
501
78
|
}
|
|
502
79
|
window.TopolPlugin.init(o), c(!0);
|
|
503
80
|
});
|
|
504
81
|
}),
|
|
82
|
+
/** Trigger the save callback with current editor content */
|
|
505
83
|
save: () => {
|
|
506
84
|
window.TopolPlugin.save();
|
|
507
85
|
},
|
|
86
|
+
/** Load a template JSON into the editor */
|
|
508
87
|
load: (o) => {
|
|
509
88
|
window.TopolPlugin.load(o);
|
|
510
89
|
},
|
|
90
|
+
/** Toggle the preview mode */
|
|
511
91
|
togglePreview: () => {
|
|
512
92
|
window.TopolPlugin.togglePreview();
|
|
513
93
|
},
|
|
94
|
+
/** Toggle between desktop and mobile preview sizes */
|
|
514
95
|
togglePreviewSize: () => {
|
|
515
96
|
window.TopolPlugin.togglePreviewSize();
|
|
516
97
|
},
|
|
98
|
+
/** Select a file from the custom file manager */
|
|
517
99
|
chooseFile: (o) => {
|
|
518
100
|
window.TopolPlugin.chooseFile(o);
|
|
519
101
|
},
|
|
102
|
+
/** Undo the last action */
|
|
520
103
|
undo: () => {
|
|
521
104
|
window.TopolPlugin.undo();
|
|
522
105
|
},
|
|
106
|
+
/** Redo the last undone action */
|
|
523
107
|
redo: () => {
|
|
524
108
|
window.TopolPlugin.redo();
|
|
525
109
|
},
|
|
110
|
+
/** Destroy the editor instance and clean up resources */
|
|
526
111
|
destroy: () => {
|
|
527
112
|
window.TopolPlugin.destroy();
|
|
528
113
|
},
|
|
114
|
+
/** Update the list of saved/reusable blocks */
|
|
529
115
|
setSavedBlocks: (o) => {
|
|
530
116
|
window.TopolPlugin.setSavedBlocks(o);
|
|
531
117
|
},
|
|
118
|
+
/** Set custom HTML for the preview */
|
|
532
119
|
setPreviewHTML: (o) => {
|
|
533
120
|
window.TopolPlugin.setPreviewHTML(o);
|
|
534
121
|
},
|
|
122
|
+
/** Display a notification in the editor */
|
|
535
123
|
createNotification: (o) => {
|
|
536
124
|
window.TopolPlugin.createNotification(o);
|
|
537
125
|
},
|
|
126
|
+
/** Set the list of active collaboration members */
|
|
538
127
|
setActiveMembers: (o) => {
|
|
539
128
|
window.TopolPlugin.setActiveMembers(o);
|
|
540
129
|
},
|
|
130
|
+
/** Switch to mobile view */
|
|
541
131
|
changeEmailToMobile: () => {
|
|
542
132
|
window.TopolPlugin.changeEmailToMobile();
|
|
543
133
|
},
|
|
134
|
+
/** Switch to desktop view */
|
|
544
135
|
changeEmailToDesktop: () => {
|
|
545
136
|
window.TopolPlugin.changeEmailToDesktop();
|
|
546
137
|
},
|
|
138
|
+
/** Toggle visibility of hidden blocks and structures */
|
|
547
139
|
toggleBlocksAndStructuresVisibility: () => {
|
|
548
140
|
window.TopolPlugin.toggleBlocksAndStructuresVisibility();
|
|
549
141
|
},
|
|
142
|
+
/** Update the content of a custom block */
|
|
550
143
|
updateCustomBlockContent: (o) => {
|
|
551
144
|
window.TopolPlugin.updateCustomBlockContent(o);
|
|
552
145
|
},
|
|
146
|
+
/** Refresh comments/conversations */
|
|
553
147
|
refreshComments: (o) => {
|
|
554
148
|
window.TopolPlugin.refreshComments(o);
|
|
555
149
|
},
|
|
150
|
+
/** Refresh synced rows */
|
|
556
151
|
refreshSyncedRows: () => {
|
|
557
152
|
window.TopolPlugin.refreshSyncedRows();
|
|
558
153
|
},
|
|
154
|
+
/** Open the premade templates selection modal */
|
|
559
155
|
openPremadeTemplatesSelection: () => {
|
|
560
156
|
window.TopolPlugin.openPremadeTemplatesSelection();
|
|
561
157
|
},
|
|
158
|
+
/** Update the API authorization header */
|
|
562
159
|
updateApiAuthorizationHeader: (o) => {
|
|
563
160
|
window.TopolPlugin.updateApiAuthorizationHeader(o);
|
|
564
161
|
},
|
|
162
|
+
/** Set the template name/title */
|
|
565
163
|
setTemplateName: (o) => {
|
|
566
164
|
window.TopolPlugin.setTemplateName(o);
|
|
567
165
|
},
|
|
166
|
+
/** Toggle the AI chat feature */
|
|
568
167
|
toggleChatAI: () => {
|
|
569
168
|
window.TopolPlugin.toggleChatAI();
|
|
570
169
|
},
|
|
170
|
+
/** Toggle the autosaves feature */
|
|
571
171
|
toggleAutosaves: () => {
|
|
572
172
|
window.TopolPlugin.toggleAutosaves();
|
|
573
173
|
},
|
|
174
|
+
/** Toggle the comments panel */
|
|
574
175
|
toggleComments: () => {
|
|
575
176
|
window.TopolPlugin.toggleComments();
|
|
576
177
|
},
|
|
178
|
+
/** Create a new language variant */
|
|
577
179
|
createLanguage: (o) => {
|
|
578
180
|
window.TopolPlugin.createLanguage(o);
|
|
579
181
|
},
|
|
182
|
+
/** Set the primary language */
|
|
580
183
|
setPrimaryLanguage: (o) => {
|
|
581
184
|
window.TopolPlugin.setPrimaryLanguage(o);
|
|
582
185
|
},
|
|
186
|
+
/** Delete a language variant */
|
|
583
187
|
deleteLanguage: (o) => {
|
|
584
188
|
window.TopolPlugin.deleteLanguage(o);
|
|
585
189
|
},
|
|
190
|
+
/** Select/switch to a language */
|
|
586
191
|
selectLanguage: (o) => {
|
|
587
192
|
window.TopolPlugin.selectLanguage(o);
|
|
588
193
|
}
|
|
589
|
-
},
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
194
|
+
}, b = "https://v1.page-assets.topol.io/topol-lpe.js", z = {
|
|
195
|
+
/**
|
|
196
|
+
* Inits Landing Page Editor.
|
|
197
|
+
*
|
|
198
|
+
* @param options - Configuration options for the editor
|
|
199
|
+
* @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
|
|
200
|
+
* @returns Promise that resolves with the editor instance
|
|
201
|
+
*/
|
|
202
|
+
init: (o, l) => new Promise((c, a) => {
|
|
203
|
+
f(b, (r) => {
|
|
204
|
+
if (r !== null) {
|
|
205
|
+
a(r);
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const u = window.LandingPageEditor(o);
|
|
209
|
+
c(u);
|
|
210
|
+
});
|
|
211
|
+
})
|
|
212
|
+
}, H = h, T = "topol-email-editor-id";
|
|
213
|
+
function M(o) {
|
|
214
|
+
const l = p(!1), c = p(!1), a = p(o);
|
|
215
|
+
return a.current = o, v(() => l.current ? void 0 : (l.current = !0, (async () => {
|
|
216
|
+
const u = a.current, d = {
|
|
217
|
+
onSave(i, n) {
|
|
218
|
+
var e, t;
|
|
219
|
+
(t = (e = a.current).onSave) == null || t.call(e, i, n);
|
|
596
220
|
},
|
|
597
|
-
onSaveAndClose(
|
|
598
|
-
|
|
221
|
+
onSaveAndClose(i, n) {
|
|
222
|
+
var e, t;
|
|
223
|
+
(t = (e = a.current).onSaveAndClose) == null || t.call(e, i, n);
|
|
599
224
|
},
|
|
600
|
-
onTestSend(
|
|
601
|
-
|
|
225
|
+
onTestSend(i, n, e) {
|
|
226
|
+
var t, s;
|
|
227
|
+
(s = (t = a.current).onTestSend) == null || s.call(t, i, n, e);
|
|
602
228
|
},
|
|
603
229
|
onOpenFileManager() {
|
|
604
|
-
|
|
230
|
+
var i, n;
|
|
231
|
+
(n = (i = a.current).onOpenFileManager) == null || n.call(i);
|
|
605
232
|
},
|
|
606
233
|
onLoaded() {
|
|
607
|
-
|
|
234
|
+
var i, n;
|
|
235
|
+
(n = (i = a.current).onLoaded) == null || n.call(i);
|
|
608
236
|
},
|
|
609
|
-
onBlockSave(
|
|
610
|
-
|
|
237
|
+
onBlockSave(i) {
|
|
238
|
+
var n, e;
|
|
239
|
+
(e = (n = a.current).onBlockSave) == null || e.call(n, i);
|
|
611
240
|
},
|
|
612
|
-
onBlockRemove(
|
|
613
|
-
|
|
241
|
+
onBlockRemove(i) {
|
|
242
|
+
var n, e;
|
|
243
|
+
(e = (n = a.current).onBlockRemove) == null || e.call(n, i);
|
|
614
244
|
},
|
|
615
|
-
onBlockEdit(
|
|
616
|
-
|
|
245
|
+
onBlockEdit(i) {
|
|
246
|
+
var n, e;
|
|
247
|
+
(e = (n = a.current).onBlockEdit) == null || e.call(n, i);
|
|
617
248
|
},
|
|
618
249
|
onInit() {
|
|
619
|
-
|
|
250
|
+
var i, n;
|
|
251
|
+
(n = (i = a.current).onInit) == null || n.call(i), c.current = !0;
|
|
620
252
|
},
|
|
621
|
-
onUndoChange(
|
|
622
|
-
|
|
253
|
+
onUndoChange(i) {
|
|
254
|
+
var n, e;
|
|
255
|
+
(e = (n = a.current).onUndoChange) == null || e.call(n, i);
|
|
623
256
|
},
|
|
624
|
-
onRedoChange(
|
|
625
|
-
|
|
257
|
+
onRedoChange(i) {
|
|
258
|
+
var n, e;
|
|
259
|
+
(e = (n = a.current).onRedoChange) == null || e.call(n, i);
|
|
626
260
|
},
|
|
627
|
-
onPreview(
|
|
628
|
-
|
|
261
|
+
onPreview(i) {
|
|
262
|
+
var n, e;
|
|
263
|
+
(e = (n = a.current).onPreview) == null || e.call(n, i);
|
|
629
264
|
},
|
|
630
|
-
onAlert(
|
|
631
|
-
|
|
265
|
+
onAlert(i) {
|
|
266
|
+
var n, e;
|
|
267
|
+
(e = (n = a.current).onAlert) == null || e.call(n, i);
|
|
632
268
|
},
|
|
633
269
|
onClose() {
|
|
634
|
-
|
|
270
|
+
var i, n;
|
|
271
|
+
(n = (i = a.current).onClose) == null || n.call(i);
|
|
272
|
+
},
|
|
273
|
+
onBannerClick(i, n) {
|
|
274
|
+
var e, t;
|
|
275
|
+
(t = (e = a.current).onBannerClick) == null || t.call(e, i, n);
|
|
635
276
|
},
|
|
636
|
-
onEdittedWithoutSaveChanged(
|
|
637
|
-
|
|
277
|
+
onEdittedWithoutSaveChanged(i) {
|
|
278
|
+
var n, e;
|
|
279
|
+
(e = (n = a.current).onEdittedWithoutSaveChanged) == null || e.call(n, i);
|
|
638
280
|
},
|
|
639
|
-
onOpenCustomBlockDialog(
|
|
640
|
-
|
|
281
|
+
onOpenCustomBlockDialog(i) {
|
|
282
|
+
var n, e;
|
|
283
|
+
(e = (n = a.current).onOpenCustomBlockDialog) == null || e.call(n, i);
|
|
641
284
|
},
|
|
642
|
-
onTemplateRename(
|
|
643
|
-
|
|
285
|
+
onTemplateRename(i) {
|
|
286
|
+
var n, e;
|
|
287
|
+
(e = (n = a.current).onTemplateRename) == null || e.call(n, i);
|
|
644
288
|
},
|
|
645
|
-
updateTestingEmailAddresses(
|
|
646
|
-
|
|
289
|
+
updateTestingEmailAddresses(i) {
|
|
290
|
+
var n, e;
|
|
291
|
+
(e = (n = a.current).updateTestingEmailAddresses) == null || e.call(n, i);
|
|
647
292
|
},
|
|
648
|
-
onError(
|
|
649
|
-
|
|
293
|
+
onError(i, n) {
|
|
294
|
+
var e, t;
|
|
295
|
+
(t = (e = a.current).onError) == null || t.call(e, i, n);
|
|
650
296
|
}
|
|
297
|
+
}, g = {
|
|
298
|
+
id: "#" + T,
|
|
299
|
+
...u.options,
|
|
300
|
+
callbacks: d
|
|
651
301
|
};
|
|
652
|
-
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}), []), /* @__PURE__ */
|
|
302
|
+
await h.init(g, { stage: u.stage || "production" });
|
|
303
|
+
})().catch((u) => {
|
|
304
|
+
var d, g;
|
|
305
|
+
(g = (d = a.current).onError) == null || g.call(d, "init", (u == null ? void 0 : u.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] EmailEditor initialization failed:", u);
|
|
306
|
+
}), () => {
|
|
307
|
+
c.current && (h.destroy(), c.current = !1);
|
|
308
|
+
const u = document.getElementById(T);
|
|
309
|
+
u && (u.innerHTML = "");
|
|
310
|
+
}), []), /* @__PURE__ */ P(
|
|
311
|
+
"div",
|
|
312
|
+
{
|
|
313
|
+
id: T,
|
|
314
|
+
style: { position: "absolute", height: "100vh", width: "100%" }
|
|
315
|
+
}
|
|
316
|
+
);
|
|
317
|
+
}
|
|
318
|
+
const C = "topol-landing-page-editor-id", _ = y((o, l) => {
|
|
319
|
+
const c = p(!1), a = p(null), r = p(o);
|
|
320
|
+
return r.current = o, S(l, () => ({
|
|
321
|
+
load(u) {
|
|
322
|
+
var d;
|
|
323
|
+
(d = a.current) == null || d.load(u);
|
|
324
|
+
},
|
|
325
|
+
save() {
|
|
326
|
+
var u;
|
|
327
|
+
(u = a.current) == null || u.save();
|
|
328
|
+
}
|
|
329
|
+
})), v(() => c.current ? void 0 : (c.current = !0, (async () => {
|
|
330
|
+
const d = r.current, g = {
|
|
331
|
+
onSave(n, e) {
|
|
332
|
+
var t, s;
|
|
333
|
+
(s = (t = r.current).onSave) == null || s.call(t, n, e);
|
|
334
|
+
},
|
|
335
|
+
onSaveAndClose(n, e) {
|
|
336
|
+
var t, s;
|
|
337
|
+
(s = (t = r.current).onSaveAndClose) == null || s.call(t, n, e);
|
|
338
|
+
},
|
|
339
|
+
onOpenFileManager() {
|
|
340
|
+
var n, e;
|
|
341
|
+
(e = (n = r.current).onOpenFileManager) == null || e.call(n);
|
|
342
|
+
},
|
|
343
|
+
onLoaded() {
|
|
344
|
+
var n, e;
|
|
345
|
+
(e = (n = r.current).onLoaded) == null || e.call(n);
|
|
346
|
+
},
|
|
347
|
+
onBlockSave(n) {
|
|
348
|
+
var e, t;
|
|
349
|
+
(t = (e = r.current).onBlockSave) == null || t.call(e, n);
|
|
350
|
+
},
|
|
351
|
+
onBlockRemove(n) {
|
|
352
|
+
var e, t;
|
|
353
|
+
(t = (e = r.current).onBlockRemove) == null || t.call(e, n);
|
|
354
|
+
},
|
|
355
|
+
onBlockEdit(n) {
|
|
356
|
+
var e, t;
|
|
357
|
+
(t = (e = r.current).onBlockEdit) == null || t.call(e, n);
|
|
358
|
+
},
|
|
359
|
+
onInit() {
|
|
360
|
+
var n, e;
|
|
361
|
+
(e = (n = r.current).onInit) == null || e.call(n);
|
|
362
|
+
},
|
|
363
|
+
onClose() {
|
|
364
|
+
var n, e;
|
|
365
|
+
(e = (n = r.current).onClose) == null || e.call(n);
|
|
366
|
+
},
|
|
367
|
+
onUndoChange(n) {
|
|
368
|
+
var e, t;
|
|
369
|
+
(t = (e = r.current).onUndoChange) == null || t.call(e, n);
|
|
370
|
+
},
|
|
371
|
+
onRedoChange(n) {
|
|
372
|
+
var e, t;
|
|
373
|
+
(t = (e = r.current).onRedoChange) == null || t.call(e, n);
|
|
374
|
+
},
|
|
375
|
+
onPreview(n) {
|
|
376
|
+
var e, t;
|
|
377
|
+
(t = (e = r.current).onPreview) == null || t.call(e, n);
|
|
378
|
+
},
|
|
379
|
+
onAlert(n) {
|
|
380
|
+
var e, t;
|
|
381
|
+
(t = (e = r.current).onAlert) == null || t.call(e, n);
|
|
382
|
+
},
|
|
383
|
+
onBannerClick(n, e) {
|
|
384
|
+
var t, s;
|
|
385
|
+
(s = (t = r.current).onBannerClick) == null || s.call(t, n, e);
|
|
386
|
+
},
|
|
387
|
+
onEdittedWithoutSaveChanged(n) {
|
|
388
|
+
var e, t;
|
|
389
|
+
(t = (e = r.current).onEdittedWithoutSaveChanged) == null || t.call(e, n);
|
|
390
|
+
},
|
|
391
|
+
onOpenCustomBlockDialog(n) {
|
|
392
|
+
var e, t;
|
|
393
|
+
(t = (e = r.current).onOpenCustomBlockDialog) == null || t.call(e, n);
|
|
394
|
+
},
|
|
395
|
+
onTemplateRename(n) {
|
|
396
|
+
var e, t;
|
|
397
|
+
(t = (e = r.current).onTemplateRename) == null || t.call(e, n);
|
|
398
|
+
},
|
|
399
|
+
onError(n, e) {
|
|
400
|
+
var t, s;
|
|
401
|
+
(s = (t = r.current).onError) == null || s.call(t, n, e);
|
|
402
|
+
}
|
|
403
|
+
}, i = await z.init({ config: d.options, ...g }, { stage: d.stage || "production" });
|
|
404
|
+
a.current = i, i.render("#" + C);
|
|
405
|
+
})().catch((d) => {
|
|
406
|
+
var g, i;
|
|
407
|
+
(i = (g = r.current).onError) == null || i.call(g, "init", (d == null ? void 0 : d.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] LandingPageEditor initialization failed:", d);
|
|
408
|
+
}), () => {
|
|
409
|
+
var d;
|
|
410
|
+
(d = a.current) == null || d.destroy(), a.current = null, c.current = !1;
|
|
411
|
+
}), []), /* @__PURE__ */ P(
|
|
661
412
|
"div",
|
|
662
413
|
{
|
|
663
|
-
id:
|
|
414
|
+
id: C,
|
|
664
415
|
style: { position: "absolute", height: "100vh", width: "100%" }
|
|
665
416
|
}
|
|
666
417
|
);
|
|
418
|
+
});
|
|
419
|
+
_.displayName = "LandingPageEditor";
|
|
420
|
+
function N(o) {
|
|
421
|
+
return v(() => {
|
|
422
|
+
console.warn("[@topol.io/editor-react] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.");
|
|
423
|
+
}, []), /* @__PURE__ */ P(M, { ...o });
|
|
667
424
|
}
|
|
668
425
|
export {
|
|
669
|
-
|
|
670
|
-
|
|
426
|
+
h as CoreEmailEditor,
|
|
427
|
+
z as CoreLandingPageEditor,
|
|
428
|
+
M as EmailEditor,
|
|
429
|
+
_ as LandingPageEditor,
|
|
430
|
+
N as TopolEditor,
|
|
431
|
+
H as TopolPlugin
|
|
671
432
|
};
|
|
@@ -1,31 +1 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
* @license React
|
|
3
|
-
* react-jsx-runtime.production.js
|
|
4
|
-
*
|
|
5
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
-
*
|
|
7
|
-
* This source code is licensed under the MIT license found in the
|
|
8
|
-
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var X;function ye(){if(X)return k;X=1;var o=Symbol.for("react.transitional.element"),l=Symbol.for("react.fragment");function c(r,i,f){var v=null;if(f!==void 0&&(v=""+f),i.key!==void 0&&(v=""+i.key),"key"in i){f={};for(var C in i)C!=="key"&&(f[C]=i[C])}else f=i;return i=f.ref,{$$typeof:o,type:r,key:v,ref:i!==void 0?i:null,props:f}}return k.Fragment=l,k.jsx=c,k.jsxs=c,k}var R={};/**
|
|
10
|
-
* @license React
|
|
11
|
-
* react-jsx-runtime.development.js
|
|
12
|
-
*
|
|
13
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
14
|
-
*
|
|
15
|
-
* This source code is licensed under the MIT license found in the
|
|
16
|
-
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var Z;function Pe(){return Z||(Z=1,process.env.NODE_ENV!=="production"&&function(){function o(e){if(e==null)return null;if(typeof e=="function")return e.$$typeof===Ve?null:e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case U:return"Fragment";case $e:return"Portal";case re:return"Profiler";case ne:return"StrictMode";case $:return"Suspense";case H:return"SuspenseList"}if(typeof e=="object")switch(typeof e.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),e.$$typeof){case ie:return(e.displayName||"Context")+".Provider";case ae:return(e._context.displayName||"Context")+".Consumer";case z:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case V:return t=e.displayName||null,t!==null?t:o(e.type)||"Memo";case F:t=e._payload,e=e._init;try{return o(e(t))}catch{}}return null}function l(e){return""+e}function c(e){try{l(e);var t=!1}catch{t=!0}if(t){t=console;var n=t.error,u=typeof Symbol=="function"&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",u),l(e)}}function r(){}function i(){if(_===0){se=console.log,ce=console.info,fe=console.warn,de=console.error,ge=console.group,ve=console.groupCollapsed,me=console.groupEnd;var e={configurable:!0,enumerable:!0,value:r,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}_++}function f(){if(_--,_===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:h({},e,{value:se}),info:h({},e,{value:ce}),warn:h({},e,{value:fe}),error:h({},e,{value:de}),group:h({},e,{value:ge}),groupCollapsed:h({},e,{value:ve}),groupEnd:h({},e,{value:me})})}0>_&&console.error("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}function v(e){if(J===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);J=t&&t[1]||"",we=-1<n.stack.indexOf(`
|
|
18
|
-
at`)?" (<anonymous>)":-1<n.stack.indexOf("@")?"@unknown:0:0":""}return`
|
|
19
|
-
`+J+e+we}function C(e,t){if(!e||q)return"";var n=G.get(e);if(n!==void 0)return n;q=!0,n=Error.prepareStackTrace,Error.prepareStackTrace=void 0;var u=null;u=b.H,b.H=null,i();try{var d={DetermineComponentFrameRoot:function(){try{if(t){var T=function(){throw Error()};if(Object.defineProperty(T.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(T,[])}catch(w){var x=w}Reflect.construct(e,[],T)}else{try{T.call()}catch(w){x=w}e.call(T.prototype)}}else{try{throw Error()}catch(w){x=w}(T=e())&&typeof T.catch=="function"&&T.catch(function(){})}}catch(w){if(w&&x&&typeof w.stack=="string")return[w.stack,x.stack]}return[null,null]}};d.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var s=Object.getOwnPropertyDescriptor(d.DetermineComponentFrameRoot,"name");s&&s.configurable&&Object.defineProperty(d.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var a=d.DetermineComponentFrameRoot(),m=a[0],S=a[1];if(m&&S){var g=m.split(`
|
|
20
|
-
`),y=S.split(`
|
|
21
|
-
`);for(a=s=0;s<g.length&&!g[s].includes("DetermineComponentFrameRoot");)s++;for(;a<y.length&&!y[a].includes("DetermineComponentFrameRoot");)a++;if(s===g.length||a===y.length)for(s=g.length-1,a=y.length-1;1<=s&&0<=a&&g[s]!==y[a];)a--;for(;1<=s&&0<=a;s--,a--)if(g[s]!==y[a]){if(s!==1||a!==1)do if(s--,a--,0>a||g[s]!==y[a]){var p=`
|
|
22
|
-
`+g[s].replace(" at new "," at ");return e.displayName&&p.includes("<anonymous>")&&(p=p.replace("<anonymous>",e.displayName)),typeof e=="function"&&G.set(e,p),p}while(1<=s&&0<=a);break}}}finally{q=!1,b.H=u,f(),Error.prepareStackTrace=n}return g=(g=e?e.displayName||e.name:"")?v(g):"",typeof e=="function"&&G.set(e,g),g}function B(e){if(e==null)return"";if(typeof e=="function"){var t=e.prototype;return C(e,!(!t||!t.isReactComponent))}if(typeof e=="string")return v(e);switch(e){case $:return v("Suspense");case H:return v("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case z:return e=C(e.render,!1),e;case V:return B(e.type);case F:t=e._payload,e=e._init;try{return B(e(t))}catch{}}return""}function Y(){var e=b.A;return e===null?null:e.getOwner()}function Be(e){if(ue.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return e.key!==void 0}function Ye(e,t){function n(){Ee||(Ee=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}function We(){var e=o(this.type);return Te[e]||(Te[e]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),e=this.props.ref,e!==void 0?e:null}function Le(e,t,n,u,d,s){return n=s.ref,e={$$typeof:L,type:e,key:t,props:s,_owner:d},(n!==void 0?n:null)!==null?Object.defineProperty(e,"ref",{enumerable:!1,get:We}):Object.defineProperty(e,"ref",{enumerable:!1,value:null}),e._store={},Object.defineProperty(e._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(e,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.freeze&&(Object.freeze(e.props),Object.freeze(e)),e}function ee(e,t,n,u,d,s){if(typeof e=="string"||typeof e=="function"||e===U||e===re||e===ne||e===$||e===H||e===He||typeof e=="object"&&e!==null&&(e.$$typeof===F||e.$$typeof===V||e.$$typeof===ie||e.$$typeof===ae||e.$$typeof===z||e.$$typeof===Fe||e.getModuleId!==void 0)){var a=t.children;if(a!==void 0)if(u)if(I(a)){for(u=0;u<a.length;u++)oe(a[u],e);Object.freeze&&Object.freeze(a)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else oe(a,e)}else a="",(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(a+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),e===null?u="null":I(e)?u="array":e!==void 0&&e.$$typeof===L?(u="<"+(o(e.type)||"Unknown")+" />",a=" Did you accidentally export a JSX literal instead of a component?"):u=typeof e,console.error("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",u,a);if(ue.call(t,"key")){a=o(e);var m=Object.keys(t).filter(function(g){return g!=="key"});u=0<m.length?"{key: someKey, "+m.join(": ..., ")+": ...}":"{key: someKey}",be[a+u]||(m=0<m.length?"{"+m.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
|
|
23
|
-
let props = %s;
|
|
24
|
-
<%s {...props} />
|
|
25
|
-
React keys must be passed directly to JSX without using spread:
|
|
26
|
-
let props = %s;
|
|
27
|
-
<%s key={someKey} {...props} />`,u,a,m,a),be[a+u]=!0)}if(a=null,n!==void 0&&(c(n),a=""+n),Be(t)&&(c(t.key),a=""+t.key),"key"in t){n={};for(var S in t)S!=="key"&&(n[S]=t[S])}else n=t;return a&&Ye(n,typeof e=="function"?e.displayName||e.name||"Unknown":e),Le(e,a,s,d,Y(),n)}function oe(e,t){if(typeof e=="object"&&e&&e.$$typeof!==Ie){if(I(e))for(var n=0;n<e.length;n++){var u=e[n];W(u)&&te(u,t)}else if(W(e))e._store&&(e._store.validated=1);else if(e===null||typeof e!="object"?n=null:(n=le&&e[le]||e["@@iterator"],n=typeof n=="function"?n:null),typeof n=="function"&&n!==e.entries&&(n=n.call(e),n!==e))for(;!(e=n.next()).done;)W(e.value)&&te(e.value,t)}}function W(e){return typeof e=="object"&&e!==null&&e.$$typeof===L}function te(e,t){if(e._store&&!e._store.validated&&e.key==null&&(e._store.validated=1,t=Ue(t),!he[t])){he[t]=!0;var n="";e&&e._owner!=null&&e._owner!==Y()&&(n=null,typeof e._owner.tag=="number"?n=o(e._owner.type):typeof e._owner.name=="string"&&(n=e._owner.name),n=" It was passed a child from "+n+".");var u=b.getCurrentStack;b.getCurrentStack=function(){var d=B(e.type);return u&&(d+=u()||""),d},console.error('Each child in a list should have a unique "key" prop.%s%s See https://react.dev/link/warning-keys for more information.',t,n),b.getCurrentStack=u}}function Ue(e){var t="",n=Y();return n&&(n=o(n.type))&&(t=`
|
|
28
|
-
|
|
29
|
-
Check the render method of \``+n+"`."),t||(e=o(e))&&(t=`
|
|
30
|
-
|
|
31
|
-
Check the top-level render call using <`+e+">."),t}var ze=P,L=Symbol.for("react.transitional.element"),$e=Symbol.for("react.portal"),U=Symbol.for("react.fragment"),ne=Symbol.for("react.strict_mode"),re=Symbol.for("react.profiler"),ae=Symbol.for("react.consumer"),ie=Symbol.for("react.context"),z=Symbol.for("react.forward_ref"),$=Symbol.for("react.suspense"),H=Symbol.for("react.suspense_list"),V=Symbol.for("react.memo"),F=Symbol.for("react.lazy"),He=Symbol.for("react.offscreen"),le=Symbol.iterator,Ve=Symbol.for("react.client.reference"),b=ze.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ue=Object.prototype.hasOwnProperty,h=Object.assign,Fe=Symbol.for("react.client.reference"),I=Array.isArray,_=0,se,ce,fe,de,ge,ve,me;r.__reactDisabledLog=!0;var J,we,q=!1,G=new(typeof WeakMap=="function"?WeakMap:Map),Ie=Symbol.for("react.client.reference"),Ee,Te={},be={},he={};R.Fragment=U,R.jsx=function(e,t,n,u,d){return ee(e,t,n,!1,u,d)},R.jsxs=function(e,t,n,u,d){return ee(e,t,n,!0,u,d)}}()),R}var Q;function Ce(){return Q||(Q=1,process.env.NODE_ENV==="production"?A.exports=ye():A.exports=Pe()),A.exports}var Se=Ce();function ke(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var Re=function(o,l,c){var r=document.head||document.getElementsByTagName("head")[0],i=document.createElement("script");typeof l=="function"&&(c=l,l={}),l=l||{},c=c||function(){},i.type=l.type||"text/javascript",i.charset=l.charset||"utf8",i.async="async"in l?!!l.async:!0,i.src=o,l.attrs&&_e(i,l.attrs),l.text&&(i.text=""+l.text);var f="onload"in i?K:pe;f(i,c),i.onload||K(i,c),r.appendChild(i)};function _e(o,l){for(var c in l)o.setAttribute(c,l[c])}function K(o,l){o.onload=function(){this.onerror=this.onload=null,l(null,o)},o.onerror=function(){this.onerror=this.onload=null,l(new Error("Failed to load "+this.src),o)}}function pe(o,l){o.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,l(null,o))}}const D=ke(Re),j="https://v3.email-assets.topol.io/loader/build.js",Ae="https://v3.develop.email-assets.topol.io/loader/build.js",xe="https://v3.develop.email-assets.topol.io/loader/build.js";function je(o="production"){switch(o){case"dev":return Ae;case"staging":return xe;case"production":return j;default:return`https://d10h8ga60f7b91.cloudfront.net/preview-app-${o}/loader/build.js`}}async function Oe(o){return new Promise((l,c)=>{D(j,r=>{r!==null&&c(r),window.TopolPlugin.init(o),l(!0)})})}const O={init:(o,l)=>new Promise((c,r)=>{const i=je(l==null?void 0:l.stage);D(i,async f=>{if(f!==null){if(i!==j)try{return await Oe(o),c(!0)}catch(v){r(v)}r(f)}window.TopolPlugin.init(o),c(!0)})}),save:()=>{window.TopolPlugin.save()},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)},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)}},Ne="editor";let N=!1,M=!1;function Me(o){const l=()=>{const c={onSave(r,i){o.onSave!==void 0&&o.onSave(r,i)},onSaveAndClose(r,i){o.onSaveAndClose!==void 0&&o.onSaveAndClose(r,i)},onTestSend(r,i,f){o.onTestSend!==void 0&&o.onTestSend(r,i,f)},onOpenFileManager(){o.onOpenFileManager!==void 0&&o.onOpenFileManager()},onLoaded(){o.onLoaded!==void 0&&o.onLoaded()},onBlockSave(r){o.onBlockSave!==void 0&&o.onBlockSave(r)},onBlockRemove(r){o.onBlockRemove!==void 0&&o.onBlockRemove(r)},onBlockEdit(r){o.onBlockEdit!==void 0&&o.onBlockEdit(r)},onInit(){o.onInit!==void 0&&o.onInit(),N=!1,M=!0},onUndoChange(r){o.onUndoChange!==void 0&&o.onUndoChange(r)},onRedoChange(r){o.onRedoChange!==void 0&&o.onRedoChange(r)},onPreview(r){o.onPreview!==void 0&&o.onPreview(r)},onAlert(r){o.onAlert!==void 0&&o.onAlert(r)},onClose(){o.onClose!==void 0&&o.onClose()},onEdittedWithoutSaveChanged(r){o.onEdittedWithoutSaveChanged!==void 0&&o.onEdittedWithoutSaveChanged(r)},onOpenCustomBlockDialog(r){o.onOpenCustomBlockDialog!==void 0&&o.onOpenCustomBlockDialog(r)},onTemplateRename(r){o.onTemplateRename!==void 0&&o.onTemplateRename(r)},updateTestingEmailAddresses(r){o.updateTestingEmailAddresses!==void 0&&o.updateTestingEmailAddresses(r)},onError(r,i){o.onError!==void 0&&o.onError(r,i)}};return{id:"#"+Ne,...o.options,callbacks:{...c}}};return P.useEffect(()=>(N||(async()=>{N=!0;const r=l();await O.init(r,{stage:o.stage||"production"})})(),()=>{M&&(O.destroy(),M=!1)}),[]),Se.jsx("div",{id:"editor",style:{position:"absolute",height:"100vh",width:"100%"}})}E.TopolPlugin=O,E.default=Me,Object.defineProperties(E,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
(function(g,f){typeof exports=="object"&&typeof module<"u"?f(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],f):(g=typeof globalThis<"u"?globalThis:g||self,f(g["topol-editor-react"]={},g.jsxRuntime,g.React))})(this,function(g,f,p){"use strict";function k(o){return o&&o.__esModule&&Object.prototype.hasOwnProperty.call(o,"default")?o.default:o}var L=function(o,l,u){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("script");typeof l=="function"&&(u=l,l={}),l=l||{},u=u||function(){},r.type=l.type||"text/javascript",r.charset=l.charset||"utf8",r.async="async"in l?!!l.async:!0,r.src=o,l.attrs&&B(r,l.attrs),l.text&&(r.text=""+l.text);var d="onload"in r?E:A;d(r,u),r.onload||E(r,u),a.appendChild(r)};function B(o,l){for(var u in l)o.setAttribute(u,l[u])}function E(o,l){o.onload=function(){this.onerror=this.onload=null,l(null,o)},o.onerror=function(){this.onerror=this.onload=null,l(new Error("Failed to load "+this.src),o)}}function A(o,l){o.onreadystatechange=function(){this.readyState!="complete"&&this.readyState!="loaded"||(this.onreadystatechange=null,l(null,o))}}const h=k(L);var P={};const m={production:P.VITE_TOPOL_URL,dev:P.VITE_TOPOL_DEV_URL,staging:P.VITE_TOPOL_STAGING_URL},I="https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";function O(o="production"){switch(o){case"dev":return m.dev;case"staging":return m.staging;case"production":return m.production;default:return I.replace("{stage}",String(o))}}async function b(o){return new Promise((l,u)=>{h(m.production,a=>{if(a!==null){u(a);return}window.TopolPlugin.init(o),l(!0)})})}const T={init:(o,l)=>new Promise((u,a)=>{const r=O(l==null?void 0:l.stage);h(r,async d=>{if(d!==null){if(r!==m.production)try{return await b(o),u(!0)}catch(c){a(c)}a(d);return}window.TopolPlugin.init(o),u(!0)})}),save:()=>{window.TopolPlugin.save()},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)},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)}},M="https://v1.page-assets.topol.io/topol-lpe.js",C={init:(o,l)=>new Promise((u,a)=>{h(M,r=>{if(r!==null){a(r);return}const d=window.LandingPageEditor(o);u(d)})})},z=T,v="topol-email-editor-id";function y(o){const l=p.useRef(!1),u=p.useRef(!1),a=p.useRef(o);return a.current=o,p.useEffect(()=>l.current?void 0:(l.current=!0,(async()=>{const d=a.current,c={onSave(i,n){var e,t;(t=(e=a.current).onSave)==null||t.call(e,i,n)},onSaveAndClose(i,n){var e,t;(t=(e=a.current).onSaveAndClose)==null||t.call(e,i,n)},onTestSend(i,n,e){var t,s;(s=(t=a.current).onTestSend)==null||s.call(t,i,n,e)},onOpenFileManager(){var i,n;(n=(i=a.current).onOpenFileManager)==null||n.call(i)},onLoaded(){var i,n;(n=(i=a.current).onLoaded)==null||n.call(i)},onBlockSave(i){var n,e;(e=(n=a.current).onBlockSave)==null||e.call(n,i)},onBlockRemove(i){var n,e;(e=(n=a.current).onBlockRemove)==null||e.call(n,i)},onBlockEdit(i){var n,e;(e=(n=a.current).onBlockEdit)==null||e.call(n,i)},onInit(){var i,n;(n=(i=a.current).onInit)==null||n.call(i),u.current=!0},onUndoChange(i){var n,e;(e=(n=a.current).onUndoChange)==null||e.call(n,i)},onRedoChange(i){var n,e;(e=(n=a.current).onRedoChange)==null||e.call(n,i)},onPreview(i){var n,e;(e=(n=a.current).onPreview)==null||e.call(n,i)},onAlert(i){var n,e;(e=(n=a.current).onAlert)==null||e.call(n,i)},onClose(){var i,n;(n=(i=a.current).onClose)==null||n.call(i)},onBannerClick(i,n){var e,t;(t=(e=a.current).onBannerClick)==null||t.call(e,i,n)},onEdittedWithoutSaveChanged(i){var n,e;(e=(n=a.current).onEdittedWithoutSaveChanged)==null||e.call(n,i)},onOpenCustomBlockDialog(i){var n,e;(e=(n=a.current).onOpenCustomBlockDialog)==null||e.call(n,i)},onTemplateRename(i){var n,e;(e=(n=a.current).onTemplateRename)==null||e.call(n,i)},updateTestingEmailAddresses(i){var n,e;(e=(n=a.current).updateTestingEmailAddresses)==null||e.call(n,i)},onError(i,n){var e,t;(t=(e=a.current).onError)==null||t.call(e,i,n)}},w={id:"#"+v,...d.options,callbacks:c};await T.init(w,{stage:d.stage||"production"})})().catch(d=>{var c,w;(w=(c=a.current).onError)==null||w.call(c,"init",(d==null?void 0:d.message)||"Failed to initialize editor"),console.error("[@topol.io/editor-react] EmailEditor initialization failed:",d)}),()=>{u.current&&(T.destroy(),u.current=!1);const d=document.getElementById(v);d&&(d.innerHTML="")}),[]),f.jsx("div",{id:v,style:{position:"absolute",height:"100vh",width:"100%"}})}const S="topol-landing-page-editor-id",R=p.forwardRef((o,l)=>{const u=p.useRef(!1),a=p.useRef(null),r=p.useRef(o);return r.current=o,p.useImperativeHandle(l,()=>({load(d){var c;(c=a.current)==null||c.load(d)},save(){var d;(d=a.current)==null||d.save()}})),p.useEffect(()=>u.current?void 0:(u.current=!0,(async()=>{const c=r.current,w={onSave(n,e){var t,s;(s=(t=r.current).onSave)==null||s.call(t,n,e)},onSaveAndClose(n,e){var t,s;(s=(t=r.current).onSaveAndClose)==null||s.call(t,n,e)},onOpenFileManager(){var n,e;(e=(n=r.current).onOpenFileManager)==null||e.call(n)},onLoaded(){var n,e;(e=(n=r.current).onLoaded)==null||e.call(n)},onBlockSave(n){var e,t;(t=(e=r.current).onBlockSave)==null||t.call(e,n)},onBlockRemove(n){var e,t;(t=(e=r.current).onBlockRemove)==null||t.call(e,n)},onBlockEdit(n){var e,t;(t=(e=r.current).onBlockEdit)==null||t.call(e,n)},onInit(){var n,e;(e=(n=r.current).onInit)==null||e.call(n)},onClose(){var n,e;(e=(n=r.current).onClose)==null||e.call(n)},onUndoChange(n){var e,t;(t=(e=r.current).onUndoChange)==null||t.call(e,n)},onRedoChange(n){var e,t;(t=(e=r.current).onRedoChange)==null||t.call(e,n)},onPreview(n){var e,t;(t=(e=r.current).onPreview)==null||t.call(e,n)},onAlert(n){var e,t;(t=(e=r.current).onAlert)==null||t.call(e,n)},onBannerClick(n,e){var t,s;(s=(t=r.current).onBannerClick)==null||s.call(t,n,e)},onEdittedWithoutSaveChanged(n){var e,t;(t=(e=r.current).onEdittedWithoutSaveChanged)==null||t.call(e,n)},onOpenCustomBlockDialog(n){var e,t;(t=(e=r.current).onOpenCustomBlockDialog)==null||t.call(e,n)},onTemplateRename(n){var e,t;(t=(e=r.current).onTemplateRename)==null||t.call(e,n)},onError(n,e){var t,s;(s=(t=r.current).onError)==null||s.call(t,n,e)}},i=await C.init({config:c.options,...w},{stage:c.stage||"production"});a.current=i,i.render("#"+S)})().catch(c=>{var w,i;(i=(w=r.current).onError)==null||i.call(w,"init",(c==null?void 0:c.message)||"Failed to initialize editor"),console.error("[@topol.io/editor-react] LandingPageEditor initialization failed:",c)}),()=>{var c;(c=a.current)==null||c.destroy(),a.current=null,u.current=!1}),[]),f.jsx("div",{id:S,style:{position:"absolute",height:"100vh",width:"100%"}})});R.displayName="LandingPageEditor";function _(o){return p.useEffect(()=>{console.warn("[@topol.io/editor-react] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.")},[]),f.jsx(y,{...o})}g.CoreEmailEditor=T,g.CoreLandingPageEditor=C,g.EmailEditor=y,g.LandingPageEditor=R,g.TopolEditor=_,g.TopolPlugin=z,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
type
|
|
4
|
-
options:
|
|
1
|
+
import type { INotification, ISavedBlock, IStage } from '@topol.io/editor';
|
|
2
|
+
import type { IReactEmailOptions } from './types';
|
|
3
|
+
export type EmailEditorProps = {
|
|
4
|
+
options: IReactEmailOptions;
|
|
5
5
|
stage?: IStage;
|
|
6
6
|
onSave?(json: unknown, html: unknown): void;
|
|
7
7
|
onSaveAndClose?(json: unknown, html: unknown): void;
|
|
8
|
-
onTestSend?(email: string, json: unknown, html: unknown): void;
|
|
8
|
+
onTestSend?(email: string | string[], json: unknown, html: unknown): void;
|
|
9
9
|
onOpenFileManager?(): void;
|
|
10
10
|
onLoaded?(): void;
|
|
11
11
|
onBlockSave?(block: ISavedBlock): void;
|
|
@@ -17,12 +17,11 @@ type TopolEditorProps = {
|
|
|
17
17
|
onPreview?(html: unknown): void;
|
|
18
18
|
onAlert?(notification: INotification): void;
|
|
19
19
|
onClose?(): void;
|
|
20
|
+
onBannerClick?(json: unknown, html: unknown): void;
|
|
20
21
|
onEdittedWithoutSaveChanged?(hasUnsavedChanges: boolean): void;
|
|
21
22
|
onOpenCustomBlockDialog?(blockContent: unknown): void;
|
|
22
23
|
onTemplateRename?(title: string): void;
|
|
23
24
|
updateTestingEmailAddresses?(emails: string[]): void;
|
|
24
25
|
onError?(type: string, message: string): void;
|
|
25
26
|
};
|
|
26
|
-
export default function
|
|
27
|
-
export type { IReactTopolOptions, INotification, ISavedBlock };
|
|
28
|
-
export { TopolPlugin };
|
|
27
|
+
export default function EmailEditor(props: EmailEditorProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { INotification, IStage, TopolSection } from '@topol.io/editor';
|
|
2
|
+
import type { IReactLandingPageOptions } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Ref handle for LandingPageEditor component.
|
|
5
|
+
* Provides methods to programmatically control the editor.
|
|
6
|
+
*/
|
|
7
|
+
export interface LandingPageEditorRef {
|
|
8
|
+
/**
|
|
9
|
+
* Load a template into the editor.
|
|
10
|
+
* @param template - The template data (JSON structure)
|
|
11
|
+
*/
|
|
12
|
+
load(template: unknown): void;
|
|
13
|
+
/**
|
|
14
|
+
* Trigger the save callback with current editor content.
|
|
15
|
+
*/
|
|
16
|
+
save(): void;
|
|
17
|
+
}
|
|
18
|
+
export type LandingPageEditorProps = {
|
|
19
|
+
options: IReactLandingPageOptions;
|
|
20
|
+
stage?: IStage;
|
|
21
|
+
onSave?(json: unknown, html: unknown): void;
|
|
22
|
+
onSaveAndClose?(json: unknown, html: unknown): void;
|
|
23
|
+
onOpenFileManager?(): void;
|
|
24
|
+
onLoaded?(): void;
|
|
25
|
+
onBlockSave?(block: TopolSection): void;
|
|
26
|
+
onBlockRemove?(blockId: number | string): void;
|
|
27
|
+
onBlockEdit?(blockId: number | string): void;
|
|
28
|
+
onInit?(): void;
|
|
29
|
+
onClose?(): void;
|
|
30
|
+
onUndoChange?(count: number): void;
|
|
31
|
+
onRedoChange?(count: number): void;
|
|
32
|
+
onPreview?(html: unknown): void;
|
|
33
|
+
onAlert?(notification: INotification): void;
|
|
34
|
+
onBannerClick?(json: unknown, html: unknown): void;
|
|
35
|
+
onEdittedWithoutSaveChanged?(hasUnsavedChanges: boolean): void;
|
|
36
|
+
onOpenCustomBlockDialog?(blockContent: unknown): void;
|
|
37
|
+
onTemplateRename?(title: string): void;
|
|
38
|
+
onError?(type: string, message: string): void;
|
|
39
|
+
};
|
|
40
|
+
declare const LandingPageEditor: import("react").ForwardRefExoticComponent<LandingPageEditorProps & import("react").RefAttributes<LandingPageEditorRef>>;
|
|
41
|
+
export default LandingPageEditor;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @topol.io/editor-react - React wrapper for Topol Editor
|
|
3
|
+
*
|
|
4
|
+
* @example Email Editor
|
|
5
|
+
* ```tsx
|
|
6
|
+
* import { EmailEditor, type IReactEmailOptions } from '@topol.io/editor-react';
|
|
7
|
+
*
|
|
8
|
+
* const options: IReactEmailOptions = {
|
|
9
|
+
* authorize: { apiKey: 'your-key', userId: 'user-123' },
|
|
10
|
+
* };
|
|
11
|
+
*
|
|
12
|
+
* function App() {
|
|
13
|
+
* return <EmailEditor options={options} onSave={(json, html) => console.log('Saved')} />;
|
|
14
|
+
* }
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @example Landing Page Editor
|
|
18
|
+
* ```tsx
|
|
19
|
+
* import { useRef } from 'react';
|
|
20
|
+
* import { LandingPageEditor, type LandingPageEditorRef, type IReactLandingPageOptions } from '@topol.io/editor-react';
|
|
21
|
+
*
|
|
22
|
+
* const options: IReactLandingPageOptions = {
|
|
23
|
+
* authorize: { apiKey: 'your-key', userId: 'user-123' },
|
|
24
|
+
* };
|
|
25
|
+
*
|
|
26
|
+
* function App() {
|
|
27
|
+
* const editorRef = useRef<LandingPageEditorRef>(null);
|
|
28
|
+
*
|
|
29
|
+
* const loadTemplate = () => {
|
|
30
|
+
* editorRef.current?.load(templateJson);
|
|
31
|
+
* };
|
|
32
|
+
*
|
|
33
|
+
* return <LandingPageEditor ref={editorRef} options={options} onSave={(json, html) => console.log('Saved')} />;
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export { default as TopolPlugin, EmailEditor as CoreEmailEditor, LandingPageEditor as CoreLandingPageEditor } from '@topol.io/editor';
|
|
38
|
+
export { default as EmailEditor } from './EmailEditor';
|
|
39
|
+
export type { EmailEditorProps } from './EmailEditor';
|
|
40
|
+
export { default as LandingPageEditor } from './LandingPageEditor';
|
|
41
|
+
export type { LandingPageEditorRef, LandingPageEditorProps } from './LandingPageEditor';
|
|
42
|
+
/**
|
|
43
|
+
* @deprecated Use EmailEditor instead. TopolEditor is an alias for backwards compatibility.
|
|
44
|
+
*/
|
|
45
|
+
export { default as TopolEditor } from './TopolEditor';
|
|
46
|
+
export type { TopolEditorProps } from './TopolEditor';
|
|
47
|
+
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from '@topol.io/editor';
|
|
48
|
+
export type { IReactEmailOptions, IReactLandingPageOptions, IReactTopolOptions } from './types';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type re-exports from core package and React-specific types.
|
|
3
|
+
*/
|
|
4
|
+
export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from '@topol.io/editor';
|
|
5
|
+
import type { ITopolOptions, ILandingPageOptions } from '@topol.io/editor';
|
|
6
|
+
/**
|
|
7
|
+
* React-specific options for EmailEditor component.
|
|
8
|
+
* Omits 'id' and 'callbacks' as they are handled internally by the React wrapper.
|
|
9
|
+
*/
|
|
10
|
+
export type IReactEmailOptions = Omit<ITopolOptions, 'id' | 'callbacks'>;
|
|
11
|
+
/**
|
|
12
|
+
* React-specific options for LandingPageEditor component.
|
|
13
|
+
* Contains only the config options, as callbacks are handled as React props.
|
|
14
|
+
*/
|
|
15
|
+
export type IReactLandingPageOptions = ILandingPageOptions['config'];
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Use IReactEmailOptions instead.
|
|
18
|
+
*/
|
|
19
|
+
export type IReactTopolOptions = IReactEmailOptions;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"email-react",
|
|
12
12
|
"email templates"
|
|
13
13
|
],
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "1.0.0-alpha.1",
|
|
15
15
|
"author": "Topol.io",
|
|
16
16
|
"homepage": "https://topol.io",
|
|
17
17
|
"license": "Apache-2.0",
|
|
@@ -21,26 +21,33 @@
|
|
|
21
21
|
"type": "module",
|
|
22
22
|
"main": "./dist/topol-editor-react.es.js",
|
|
23
23
|
"module": "./dist/topol-editor-react.es.js",
|
|
24
|
-
"types": "./dist/types/src/
|
|
24
|
+
"types": "./dist/types/src/entry.d.ts",
|
|
25
25
|
"exports": {
|
|
26
26
|
".": {
|
|
27
|
-
"types": "./dist/types/src/
|
|
27
|
+
"types": "./dist/types/src/entry.d.ts",
|
|
28
28
|
"import": "./dist/topol-editor-react.es.js",
|
|
29
29
|
"require": "./dist/topol-editor-react.umd.js"
|
|
30
30
|
}
|
|
31
31
|
},
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
34
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
35
|
+
},
|
|
32
36
|
"dependencies": {
|
|
33
|
-
"@topol.io/editor": "0.
|
|
37
|
+
"@topol.io/editor": "1.0.0-alpha.1"
|
|
34
38
|
},
|
|
35
39
|
"devDependencies": {
|
|
40
|
+
"@testing-library/react": "^16.1.0",
|
|
36
41
|
"@types/node": "^20.7.0",
|
|
37
42
|
"@types/react": "^19.0.10",
|
|
38
43
|
"@types/react-dom": "^19.0.4",
|
|
39
44
|
"@vitejs/plugin-react": "^4.2.1",
|
|
45
|
+
"happy-dom": "^20.0.11",
|
|
40
46
|
"react": "^19.0.0",
|
|
41
47
|
"react-dom": "^19.0.0",
|
|
42
48
|
"typescript": "^5.2.2",
|
|
43
|
-
"vite": "^6.2.0"
|
|
49
|
+
"vite": "^6.2.0",
|
|
50
|
+
"vitest": "^4.0.16"
|
|
44
51
|
},
|
|
45
52
|
"publishConfig": {
|
|
46
53
|
"access": "public"
|
|
@@ -48,6 +55,8 @@
|
|
|
48
55
|
"scripts": {
|
|
49
56
|
"dev": "vite",
|
|
50
57
|
"build": "vite build && pnpm run build:types",
|
|
51
|
-
"build:types": "tsc -p tsconfig.prod.json"
|
|
58
|
+
"build:types": "tsc -p tsconfig.prod.json",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"test:watch": "vitest"
|
|
52
61
|
}
|
|
53
62
|
}
|