@topol.io/editor-react 0.2.1 → 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.
@@ -1,5 +1,215 @@
1
- import Oe, { useEffect as je } from "react";
2
- var A = { exports: {} }, P = {};
1
+ import Be, { useRef as _, useEffect as D, forwardRef as Me, useImperativeHandle as Le } from "react";
2
+ function ze(t) {
3
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
4
+ }
5
+ var Ye = function(t, d, g) {
6
+ var s = document.head || document.getElementsByTagName("head")[0], u = document.createElement("script");
7
+ typeof d == "function" && (g = d, d = {}), d = d || {}, g = g || function() {
8
+ }, u.type = d.type || "text/javascript", u.charset = d.charset || "utf8", u.async = "async" in d ? !!d.async : !0, u.src = t, d.attrs && Ie(u, d.attrs), d.text && (u.text = "" + d.text);
9
+ var E = "onload" in u ? he : Ue;
10
+ E(u, g), u.onload || he(u, g), s.appendChild(u);
11
+ };
12
+ function Ie(t, d) {
13
+ for (var g in d)
14
+ t.setAttribute(g, d[g]);
15
+ }
16
+ function he(t, d) {
17
+ t.onload = function() {
18
+ this.onerror = this.onload = null, d(null, t);
19
+ }, t.onerror = function() {
20
+ this.onerror = this.onload = null, d(new Error("Failed to load " + this.src), t);
21
+ };
22
+ }
23
+ function Ue(t, d) {
24
+ t.onreadystatechange = function() {
25
+ this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, d(null, t));
26
+ };
27
+ }
28
+ const Z = /* @__PURE__ */ ze(Ye);
29
+ var J = {};
30
+ const N = {
31
+ production: J.VITE_TOPOL_URL,
32
+ dev: J.VITE_TOPOL_DEV_URL,
33
+ staging: J.VITE_TOPOL_STAGING_URL
34
+ }, We = "https://d10h8ga60f7b91.cloudfront.net/preview-app-{stage}/loader/build.js";
35
+ function $e(t = "production") {
36
+ switch (t) {
37
+ case "dev":
38
+ return N.dev;
39
+ case "staging":
40
+ return N.staging;
41
+ case "production":
42
+ return N.production;
43
+ default:
44
+ return We.replace("{stage}", String(t));
45
+ }
46
+ }
47
+ async function Ve(t) {
48
+ return new Promise((d, g) => {
49
+ Z(N.production, (s) => {
50
+ if (s !== null) {
51
+ g(s);
52
+ return;
53
+ }
54
+ window.TopolPlugin.init(t), d(!0);
55
+ });
56
+ });
57
+ }
58
+ const X = {
59
+ /**
60
+ * Initialize the Email Editor.
61
+ * @param topolOptions - Configuration options for the editor
62
+ * @param options - Plugin options including stage selection
63
+ * @returns Promise that resolves to true when the editor is ready
64
+ */
65
+ init: (t, d) => new Promise((g, s) => {
66
+ const u = $e(d == null ? void 0 : d.stage);
67
+ Z(u, async (E) => {
68
+ if (E !== null) {
69
+ if (u !== N.production)
70
+ try {
71
+ return await Ve(t), g(!0);
72
+ } catch (v) {
73
+ s(v);
74
+ }
75
+ s(E);
76
+ return;
77
+ }
78
+ window.TopolPlugin.init(t), g(!0);
79
+ });
80
+ }),
81
+ /** Trigger the save callback with current editor content */
82
+ save: () => {
83
+ window.TopolPlugin.save();
84
+ },
85
+ /** Load a template JSON into the editor */
86
+ load: (t) => {
87
+ window.TopolPlugin.load(t);
88
+ },
89
+ /** Toggle the preview mode */
90
+ togglePreview: () => {
91
+ window.TopolPlugin.togglePreview();
92
+ },
93
+ /** Toggle between desktop and mobile preview sizes */
94
+ togglePreviewSize: () => {
95
+ window.TopolPlugin.togglePreviewSize();
96
+ },
97
+ /** Select a file from the custom file manager */
98
+ chooseFile: (t) => {
99
+ window.TopolPlugin.chooseFile(t);
100
+ },
101
+ /** Undo the last action */
102
+ undo: () => {
103
+ window.TopolPlugin.undo();
104
+ },
105
+ /** Redo the last undone action */
106
+ redo: () => {
107
+ window.TopolPlugin.redo();
108
+ },
109
+ /** Destroy the editor instance and clean up resources */
110
+ destroy: () => {
111
+ window.TopolPlugin.destroy();
112
+ },
113
+ /** Update the list of saved/reusable blocks */
114
+ setSavedBlocks: (t) => {
115
+ window.TopolPlugin.setSavedBlocks(t);
116
+ },
117
+ /** Set custom HTML for the preview */
118
+ setPreviewHTML: (t) => {
119
+ window.TopolPlugin.setPreviewHTML(t);
120
+ },
121
+ /** Display a notification in the editor */
122
+ createNotification: (t) => {
123
+ window.TopolPlugin.createNotification(t);
124
+ },
125
+ /** Set the list of active collaboration members */
126
+ setActiveMembers: (t) => {
127
+ window.TopolPlugin.setActiveMembers(t);
128
+ },
129
+ /** Switch to mobile view */
130
+ changeEmailToMobile: () => {
131
+ window.TopolPlugin.changeEmailToMobile();
132
+ },
133
+ /** Switch to desktop view */
134
+ changeEmailToDesktop: () => {
135
+ window.TopolPlugin.changeEmailToDesktop();
136
+ },
137
+ /** Toggle visibility of hidden blocks and structures */
138
+ toggleBlocksAndStructuresVisibility: () => {
139
+ window.TopolPlugin.toggleBlocksAndStructuresVisibility();
140
+ },
141
+ /** Update the content of a custom block */
142
+ updateCustomBlockContent: (t) => {
143
+ window.TopolPlugin.updateCustomBlockContent(t);
144
+ },
145
+ /** Refresh comments/conversations */
146
+ refreshComments: (t) => {
147
+ window.TopolPlugin.refreshComments(t);
148
+ },
149
+ /** Refresh synced rows */
150
+ refreshSyncedRows: () => {
151
+ window.TopolPlugin.refreshSyncedRows();
152
+ },
153
+ /** Open the premade templates selection modal */
154
+ openPremadeTemplatesSelection: () => {
155
+ window.TopolPlugin.openPremadeTemplatesSelection();
156
+ },
157
+ /** Update the API authorization header */
158
+ updateApiAuthorizationHeader: (t) => {
159
+ window.TopolPlugin.updateApiAuthorizationHeader(t);
160
+ },
161
+ /** Set the template name/title */
162
+ setTemplateName: (t) => {
163
+ window.TopolPlugin.setTemplateName(t);
164
+ },
165
+ /** Toggle the AI chat feature */
166
+ toggleChatAI: () => {
167
+ window.TopolPlugin.toggleChatAI();
168
+ },
169
+ /** Toggle the autosaves feature */
170
+ toggleAutosaves: () => {
171
+ window.TopolPlugin.toggleAutosaves();
172
+ },
173
+ /** Toggle the comments panel */
174
+ toggleComments: () => {
175
+ window.TopolPlugin.toggleComments();
176
+ },
177
+ /** Create a new language variant */
178
+ createLanguage: (t) => {
179
+ window.TopolPlugin.createLanguage(t);
180
+ },
181
+ /** Set the primary language */
182
+ setPrimaryLanguage: (t) => {
183
+ window.TopolPlugin.setPrimaryLanguage(t);
184
+ },
185
+ /** Delete a language variant */
186
+ deleteLanguage: (t) => {
187
+ window.TopolPlugin.deleteLanguage(t);
188
+ },
189
+ /** Select/switch to a language */
190
+ selectLanguage: (t) => {
191
+ window.TopolPlugin.selectLanguage(t);
192
+ }
193
+ }, He = "https://v1.page-assets.topol.io/topol-lpe.js", Fe = {
194
+ /**
195
+ * Inits Landing Page Editor.
196
+ *
197
+ * @param options - Configuration options for the editor
198
+ * @param pluginOptions - Plugin options (reserved for future staging/dev URL support)
199
+ * @returns Promise that resolves with the editor instance
200
+ */
201
+ init: (t, d) => new Promise((g, s) => {
202
+ Z(He, (u) => {
203
+ if (u !== null) {
204
+ s(u);
205
+ return;
206
+ }
207
+ const E = window.LandingPageEditor(t);
208
+ g(E);
209
+ });
210
+ })
211
+ }, Qe = X;
212
+ var M = { exports: {} }, x = {};
3
213
  /**
4
214
  * @license React
5
215
  * react-jsx-runtime.production.js
@@ -9,29 +219,29 @@ var A = { exports: {} }, P = {};
9
219
  * This source code is licensed under the MIT license found in the
10
220
  * LICENSE file in the root directory of this source tree.
11
221
  */
12
- var ve;
13
- function pe() {
14
- if (ve) return P;
15
- ve = 1;
16
- var o = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
17
- function c(r, i, f) {
18
- var g = null;
19
- if (f !== void 0 && (g = "" + f), i.key !== void 0 && (g = "" + 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: g,
28
- ref: i !== void 0 ? i : null,
29
- props: f
222
+ var be;
223
+ function qe() {
224
+ if (be) return x;
225
+ be = 1;
226
+ var t = Symbol.for("react.transitional.element"), d = Symbol.for("react.fragment");
227
+ function g(s, u, E) {
228
+ var v = null;
229
+ if (E !== void 0 && (v = "" + E), u.key !== void 0 && (v = "" + u.key), "key" in u) {
230
+ E = {};
231
+ for (var m in u)
232
+ m !== "key" && (E[m] = u[m]);
233
+ } else E = u;
234
+ return u = E.ref, {
235
+ $$typeof: t,
236
+ type: s,
237
+ key: v,
238
+ ref: u !== void 0 ? u : null,
239
+ props: E
30
240
  };
31
241
  }
32
- return P.Fragment = l, P.jsx = c, P.jsxs = c, P;
242
+ return x.Fragment = d, x.jsx = g, x.jsxs = g, x;
33
243
  }
34
- var R = {};
244
+ var j = {};
35
245
  /**
36
246
  * @license React
37
247
  * react-jsx-runtime.development.js
@@ -41,79 +251,79 @@ var R = {};
41
251
  * This source code is licensed under the MIT license found in the
42
252
  * LICENSE file in the root directory of this source tree.
43
253
  */
44
- var ge;
45
- function Ne() {
46
- return ge || (ge = 1, process.env.NODE_ENV !== "production" && function() {
47
- function o(e) {
254
+ var Pe;
255
+ function Ge() {
256
+ return Pe || (Pe = 1, process.env.NODE_ENV !== "production" && function() {
257
+ function t(e) {
48
258
  if (e == null) return null;
49
259
  if (typeof e == "function")
50
- return e.$$typeof === _e ? null : e.displayName || e.name || null;
260
+ return e.$$typeof === xe ? null : e.displayName || e.name || null;
51
261
  if (typeof e == "string") return e;
52
262
  switch (e) {
53
- case N:
263
+ case Y:
54
264
  return "Fragment";
55
- case Pe:
265
+ case Ae:
56
266
  return "Portal";
57
- case Z:
267
+ case te:
58
268
  return "Profiler";
59
- case X:
269
+ case ne:
60
270
  return "StrictMode";
61
- case B:
271
+ case U:
62
272
  return "Suspense";
63
- case Y:
273
+ case W:
64
274
  return "SuspenseList";
65
275
  }
66
276
  if (typeof e == "object")
67
277
  switch (typeof e.tag == "number" && console.error(
68
278
  "Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
69
279
  ), e.$$typeof) {
70
- case K:
280
+ case ae:
71
281
  return (e.displayName || "Context") + ".Provider";
72
- case Q:
282
+ case re:
73
283
  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";
284
+ case I:
285
+ var r = e.render;
286
+ return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
79
287
  case $:
80
- t = e._payload, e = e._init;
288
+ return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
289
+ case V:
290
+ r = e._payload, e = e._init;
81
291
  try {
82
- return o(e(t));
292
+ return t(e(r));
83
293
  } catch {
84
294
  }
85
295
  }
86
296
  return null;
87
297
  }
88
- function l(e) {
298
+ function d(e) {
89
299
  return "" + e;
90
300
  }
91
- function c(e) {
301
+ function g(e) {
92
302
  try {
93
- l(e);
94
- var t = !1;
303
+ d(e);
304
+ var r = !1;
95
305
  } catch {
96
- t = !0;
306
+ r = !0;
97
307
  }
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,
308
+ if (r) {
309
+ r = console;
310
+ var a = r.error, f = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
311
+ return a.call(
312
+ r,
103
313
  "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);
314
+ f
315
+ ), d(e);
106
316
  }
107
317
  }
108
- function r() {
318
+ function s() {
109
319
  }
110
- function i() {
111
- if (S === 0) {
112
- oe = console.log, te = console.info, ne = console.warn, re = console.error, ae = console.group, ie = console.groupCollapsed, le = console.groupEnd;
320
+ function u() {
321
+ if (A === 0) {
322
+ ue = console.log, se = console.info, ce = console.warn, de = console.error, fe = console.group, ge = console.groupCollapsed, ve = console.groupEnd;
113
323
  var e = {
114
324
  configurable: !0,
115
325
  enumerable: !0,
116
- value: r,
326
+ value: s,
117
327
  writable: !0
118
328
  };
119
329
  Object.defineProperties(console, {
@@ -126,204 +336,204 @@ function Ne() {
126
336
  groupEnd: e
127
337
  });
128
338
  }
129
- S++;
339
+ A++;
130
340
  }
131
- function f() {
132
- if (S--, S === 0) {
341
+ function E() {
342
+ if (A--, A === 0) {
133
343
  var e = { configurable: !0, enumerable: !0, writable: !0 };
134
344
  Object.defineProperties(console, {
135
- log: T({}, e, { value: oe }),
136
- info: T({}, e, { value: te }),
137
- warn: T({}, e, { value: ne }),
138
- error: T({}, e, { value: re }),
139
- group: T({}, e, { value: ae }),
140
- groupCollapsed: T({}, e, { value: ie }),
141
- groupEnd: T({}, e, { value: le })
345
+ log: R({}, e, { value: ue }),
346
+ info: R({}, e, { value: se }),
347
+ warn: R({}, e, { value: ce }),
348
+ error: R({}, e, { value: de }),
349
+ group: R({}, e, { value: fe }),
350
+ groupCollapsed: R({}, e, { value: ge }),
351
+ groupEnd: R({}, e, { value: ve })
142
352
  });
143
353
  }
144
- 0 > S && console.error(
354
+ 0 > A && console.error(
145
355
  "disabledDepth fell below zero. This is a bug in React. Please file an issue."
146
356
  );
147
357
  }
148
- function g(e) {
149
- if (z === void 0)
358
+ function v(e) {
359
+ if (F === void 0)
150
360
  try {
151
361
  throw Error();
152
- } catch (n) {
153
- var t = n.stack.trim().match(/\n( *(at )?)/);
154
- z = t && t[1] || "", ue = -1 < n.stack.indexOf(`
155
- at`) ? " (<anonymous>)" : -1 < n.stack.indexOf("@") ? "@unknown:0:0" : "";
362
+ } catch (a) {
363
+ var r = a.stack.trim().match(/\n( *(at )?)/);
364
+ F = r && r[1] || "", Ee = -1 < a.stack.indexOf(`
365
+ at`) ? " (<anonymous>)" : -1 < a.stack.indexOf("@") ? "@unknown:0:0" : "";
156
366
  }
157
367
  return `
158
- ` + z + e + ue;
368
+ ` + F + e + Ee;
159
369
  }
160
- function y(e, t) {
161
- if (!e || H) return "";
162
- var n = V.get(e);
163
- if (n !== void 0) return n;
164
- H = !0, n = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
165
- var u = null;
166
- u = b.H, b.H = null, i();
370
+ function m(e, r) {
371
+ if (!e || q) return "";
372
+ var a = G.get(e);
373
+ if (a !== void 0) return a;
374
+ q = !0, a = Error.prepareStackTrace, Error.prepareStackTrace = void 0;
375
+ var f = null;
376
+ f = y.H, y.H = null, u();
167
377
  try {
168
- var d = {
378
+ var T = {
169
379
  DetermineComponentFrameRoot: function() {
170
380
  try {
171
- if (t) {
172
- var w = function() {
381
+ if (r) {
382
+ var C = function() {
173
383
  throw Error();
174
384
  };
175
- if (Object.defineProperty(w.prototype, "props", {
385
+ if (Object.defineProperty(C.prototype, "props", {
176
386
  set: function() {
177
387
  throw Error();
178
388
  }
179
389
  }), typeof Reflect == "object" && Reflect.construct) {
180
390
  try {
181
- Reflect.construct(w, []);
182
- } catch (m) {
183
- var _ = m;
391
+ Reflect.construct(C, []);
392
+ } catch (P) {
393
+ var B = P;
184
394
  }
185
- Reflect.construct(e, [], w);
395
+ Reflect.construct(e, [], C);
186
396
  } else {
187
397
  try {
188
- w.call();
189
- } catch (m) {
190
- _ = m;
398
+ C.call();
399
+ } catch (P) {
400
+ B = P;
191
401
  }
192
- e.call(w.prototype);
402
+ e.call(C.prototype);
193
403
  }
194
404
  } else {
195
405
  try {
196
406
  throw Error();
197
- } catch (m) {
198
- _ = m;
407
+ } catch (P) {
408
+ B = P;
199
409
  }
200
- (w = e()) && typeof w.catch == "function" && w.catch(function() {
410
+ (C = e()) && typeof C.catch == "function" && C.catch(function() {
201
411
  });
202
412
  }
203
- } catch (m) {
204
- if (m && _ && typeof m.stack == "string")
205
- return [m.stack, _.stack];
413
+ } catch (P) {
414
+ if (P && B && typeof P.stack == "string")
415
+ return [P.stack, B.stack];
206
416
  }
207
417
  return [null, null];
208
418
  }
209
419
  };
210
- d.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
211
- var s = Object.getOwnPropertyDescriptor(
212
- d.DetermineComponentFrameRoot,
420
+ T.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
421
+ var p = Object.getOwnPropertyDescriptor(
422
+ T.DetermineComponentFrameRoot,
213
423
  "name"
214
424
  );
215
- s && s.configurable && Object.defineProperty(
216
- d.DetermineComponentFrameRoot,
425
+ p && p.configurable && Object.defineProperty(
426
+ T.DetermineComponentFrameRoot,
217
427
  "name",
218
428
  { value: "DetermineComponentFrameRoot" }
219
429
  );
220
- var a = d.DetermineComponentFrameRoot(), E = a[0], C = a[1];
221
- if (E && C) {
222
- var v = E.split(`
223
- `), h = C.split(`
430
+ var c = T.DetermineComponentFrameRoot(), b = c[0], k = c[1];
431
+ if (b && k) {
432
+ var h = b.split(`
433
+ `), S = k.split(`
224
434
  `);
225
- for (a = s = 0; s < v.length && !v[s].includes(
435
+ for (c = p = 0; p < h.length && !h[p].includes(
226
436
  "DetermineComponentFrameRoot"
227
437
  ); )
228
- s++;
229
- for (; a < h.length && !h[a].includes(
438
+ p++;
439
+ for (; c < S.length && !S[c].includes(
230
440
  "DetermineComponentFrameRoot"
231
441
  ); )
232
- a++;
233
- if (s === v.length || a === h.length)
234
- for (s = v.length - 1, a = h.length - 1; 1 <= s && 0 <= a && v[s] !== h[a]; )
235
- a--;
236
- for (; 1 <= s && 0 <= a; s--, a--)
237
- if (v[s] !== h[a]) {
238
- if (s !== 1 || a !== 1)
442
+ c++;
443
+ if (p === h.length || c === S.length)
444
+ for (p = h.length - 1, c = S.length - 1; 1 <= p && 0 <= c && h[p] !== S[c]; )
445
+ c--;
446
+ for (; 1 <= p && 0 <= c; p--, c--)
447
+ if (h[p] !== S[c]) {
448
+ if (p !== 1 || c !== 1)
239
449
  do
240
- if (s--, a--, 0 > a || v[s] !== h[a]) {
241
- var k = `
242
- ` + v[s].replace(
450
+ if (p--, c--, 0 > c || h[p] !== S[c]) {
451
+ var O = `
452
+ ` + h[p].replace(
243
453
  " at new ",
244
454
  " at "
245
455
  );
246
- return e.displayName && k.includes("<anonymous>") && (k = k.replace("<anonymous>", e.displayName)), typeof e == "function" && V.set(e, k), k;
456
+ return e.displayName && O.includes("<anonymous>") && (O = O.replace("<anonymous>", e.displayName)), typeof e == "function" && G.set(e, O), O;
247
457
  }
248
- while (1 <= s && 0 <= a);
458
+ while (1 <= p && 0 <= c);
249
459
  break;
250
460
  }
251
461
  }
252
462
  } finally {
253
- H = !1, b.H = u, f(), Error.prepareStackTrace = n;
463
+ q = !1, y.H = f, E(), Error.prepareStackTrace = a;
254
464
  }
255
- return v = (v = e ? e.displayName || e.name : "") ? g(v) : "", typeof e == "function" && V.set(e, v), v;
465
+ return h = (h = e ? e.displayName || e.name : "") ? v(h) : "", typeof e == "function" && G.set(e, h), h;
256
466
  }
257
- function x(e) {
467
+ function l(e) {
258
468
  if (e == null) return "";
259
469
  if (typeof e == "function") {
260
- var t = e.prototype;
261
- return y(
470
+ var r = e.prototype;
471
+ return m(
262
472
  e,
263
- !(!t || !t.isReactComponent)
473
+ !(!r || !r.isReactComponent)
264
474
  );
265
475
  }
266
- if (typeof e == "string") return g(e);
476
+ if (typeof e == "string") return v(e);
267
477
  switch (e) {
268
- case B:
269
- return g("Suspense");
270
- case Y:
271
- return g("SuspenseList");
478
+ case U:
479
+ return v("Suspense");
480
+ case W:
481
+ return v("SuspenseList");
272
482
  }
273
483
  if (typeof e == "object")
274
484
  switch (e.$$typeof) {
275
- case M:
276
- return e = y(e.render, !1), e;
277
- case W:
278
- return x(e.type);
485
+ case I:
486
+ return e = m(e.render, !1), e;
279
487
  case $:
280
- t = e._payload, e = e._init;
488
+ return l(e.type);
489
+ case V:
490
+ r = e._payload, e = e._init;
281
491
  try {
282
- return x(e(t));
492
+ return l(e(r));
283
493
  } catch {
284
494
  }
285
495
  }
286
496
  return "";
287
497
  }
288
- function O() {
289
- var e = b.A;
498
+ function o() {
499
+ var e = y.A;
290
500
  return e === null ? null : e.getOwner();
291
501
  }
292
- function Te(e) {
293
- if (ee.call(e, "key")) {
294
- var t = Object.getOwnPropertyDescriptor(e, "key").get;
295
- if (t && t.isReactWarning) return !1;
502
+ function n(e) {
503
+ if (le.call(e, "key")) {
504
+ var r = Object.getOwnPropertyDescriptor(e, "key").get;
505
+ if (r && r.isReactWarning) return !1;
296
506
  }
297
507
  return e.key !== void 0;
298
508
  }
299
- function he(e, t) {
300
- function n() {
301
- se || (se = !0, console.error(
509
+ function i(e, r) {
510
+ function a() {
511
+ pe || (pe = !0, console.error(
302
512
  "%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
513
+ r
304
514
  ));
305
515
  }
306
- n.isReactWarning = !0, Object.defineProperty(e, "key", {
307
- get: n,
516
+ a.isReactWarning = !0, Object.defineProperty(e, "key", {
517
+ get: a,
308
518
  configurable: !0
309
519
  });
310
520
  }
311
- function ye() {
312
- var e = o(this.type);
313
- return ce[e] || (ce[e] = !0, console.error(
521
+ function w() {
522
+ var e = t(this.type);
523
+ return me[e] || (me[e] = !0, console.error(
314
524
  "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
525
  )), e = this.props.ref, e !== void 0 ? e : null;
316
526
  }
317
- function Ce(e, t, n, u, d, s) {
318
- return n = s.ref, e = {
319
- $$typeof: p,
527
+ function Se(e, r, a, f, T, p) {
528
+ return a = p.ref, e = {
529
+ $$typeof: z,
320
530
  type: e,
321
- key: t,
322
- props: s,
323
- _owner: d
324
- }, (n !== void 0 ? n : null) !== null ? Object.defineProperty(e, "ref", {
531
+ key: r,
532
+ props: p,
533
+ _owner: T
534
+ }, (a !== void 0 ? a : null) !== null ? Object.defineProperty(e, "ref", {
325
535
  enumerable: !1,
326
- get: ye
536
+ get: w
327
537
  }) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
328
538
  configurable: !1,
329
539
  enumerable: !1,
@@ -336,315 +546,322 @@ function Ne() {
336
546
  value: null
337
547
  }), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
338
548
  }
339
- function L(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 === Re || typeof e == "object" && e !== null && (e.$$typeof === $ || e.$$typeof === W || e.$$typeof === K || e.$$typeof === Q || e.$$typeof === M || e.$$typeof === Ae || e.getModuleId !== void 0)) {
341
- var a = t.children;
342
- if (a !== void 0)
343
- if (u)
344
- if (U(a)) {
345
- for (u = 0; u < a.length; u++)
346
- G(a[u], e);
347
- Object.freeze && Object.freeze(a);
549
+ function K(e, r, a, f, T, p) {
550
+ if (typeof e == "string" || typeof e == "function" || e === Y || e === te || e === ne || e === U || e === W || e === Oe || typeof e == "object" && e !== null && (e.$$typeof === V || e.$$typeof === $ || e.$$typeof === ae || e.$$typeof === re || e.$$typeof === I || e.$$typeof === je || e.getModuleId !== void 0)) {
551
+ var c = r.children;
552
+ if (c !== void 0)
553
+ if (f)
554
+ if (H(c)) {
555
+ for (f = 0; f < c.length; f++)
556
+ ee(c[f], e);
557
+ Object.freeze && Object.freeze(c);
348
558
  } else
349
559
  console.error(
350
560
  "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
561
  );
352
- else G(a, e);
562
+ else ee(c, e);
353
563
  } 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" : U(e) ? u = "array" : e !== void 0 && e.$$typeof === p ? (u = "<" + (o(e.type) || "Unknown") + " />", a = " Did you accidentally export a JSX literal instead of a component?") : u = typeof e, console.error(
564
+ c = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (c += " 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 ? f = "null" : H(e) ? f = "array" : e !== void 0 && e.$$typeof === z ? (f = "<" + (t(e.type) || "Unknown") + " />", c = " Did you accidentally export a JSX literal instead of a component?") : f = typeof e, console.error(
355
565
  "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
566
+ f,
567
+ c
358
568
  );
359
- if (ee.call(t, "key")) {
360
- a = o(e);
361
- var E = Object.keys(t).filter(function(v) {
362
- return v !== "key";
569
+ if (le.call(r, "key")) {
570
+ c = t(e);
571
+ var b = Object.keys(r).filter(function(h) {
572
+ return h !== "key";
363
573
  });
364
- u = 0 < E.length ? "{key: someKey, " + E.join(": ..., ") + ": ...}" : "{key: someKey}", fe[a + u] || (E = 0 < E.length ? "{" + E.join(": ..., ") + ": ...}" : "{}", console.error(
574
+ f = 0 < b.length ? "{key: someKey, " + b.join(": ..., ") + ": ...}" : "{key: someKey}", we[c + f] || (b = 0 < b.length ? "{" + b.join(": ..., ") + ": ...}" : "{}", console.error(
365
575
  `A props object containing a "key" prop is being spread into JSX:
366
576
  let props = %s;
367
577
  <%s {...props} />
368
578
  React keys must be passed directly to JSX without using spread:
369
579
  let props = %s;
370
580
  <%s key={someKey} {...props} />`,
371
- u,
372
- a,
373
- E,
374
- a
375
- ), fe[a + u] = !0);
581
+ f,
582
+ c,
583
+ b,
584
+ c
585
+ ), we[c + f] = !0);
376
586
  }
377
- if (a = null, n !== void 0 && (c(n), a = "" + n), Te(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,
587
+ if (c = null, a !== void 0 && (g(a), c = "" + a), n(r) && (g(r.key), c = "" + r.key), "key" in r) {
588
+ a = {};
589
+ for (var k in r)
590
+ k !== "key" && (a[k] = r[k]);
591
+ } else a = r;
592
+ return c && i(
593
+ a,
384
594
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
385
- ), Ce(e, a, s, d, O(), n);
595
+ ), Se(e, c, p, T, o(), a);
386
596
  }
387
- function G(e, t) {
388
- if (typeof e == "object" && e && e.$$typeof !== xe) {
389
- if (U(e))
390
- for (var n = 0; n < e.length; n++) {
391
- var u = e[n];
392
- j(u) && I(u, t);
597
+ function ee(e, r) {
598
+ if (typeof e == "object" && e && e.$$typeof !== Ne) {
599
+ if (H(e))
600
+ for (var a = 0; a < e.length; a++) {
601
+ var f = e[a];
602
+ L(f) && oe(f, r);
393
603
  }
394
- else if (j(e))
604
+ else if (L(e))
395
605
  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
- j(e.value) && I(e.value, t);
606
+ else if (e === null || typeof e != "object" ? a = null : (a = ie && e[ie] || e["@@iterator"], a = typeof a == "function" ? a : null), typeof a == "function" && a !== e.entries && (a = a.call(e), a !== e))
607
+ for (; !(e = a.next()).done; )
608
+ L(e.value) && oe(e.value, r);
399
609
  }
400
610
  }
401
- function j(e) {
402
- return typeof e == "object" && e !== null && e.$$typeof === p;
611
+ function L(e) {
612
+ return typeof e == "object" && e !== null && e.$$typeof === z;
403
613
  }
404
- function I(e, t) {
405
- if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, t = Se(t), !de[t])) {
406
- de[t] = !0;
407
- var n = "";
408
- e && e._owner != null && e._owner !== O() && (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 = b.getCurrentStack;
410
- b.getCurrentStack = function() {
411
- var d = x(e.type);
412
- return u && (d += u() || ""), d;
614
+ function oe(e, r) {
615
+ if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, r = ke(r), !Te[r])) {
616
+ Te[r] = !0;
617
+ var a = "";
618
+ e && e._owner != null && e._owner !== o() && (a = null, typeof e._owner.tag == "number" ? a = t(e._owner.type) : typeof e._owner.name == "string" && (a = e._owner.name), a = " It was passed a child from " + a + ".");
619
+ var f = y.getCurrentStack;
620
+ y.getCurrentStack = function() {
621
+ var T = l(e.type);
622
+ return f && (T += f() || ""), T;
413
623
  }, console.error(
414
624
  '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
- ), b.getCurrentStack = u;
625
+ r,
626
+ a
627
+ ), y.getCurrentStack = f;
418
628
  }
419
629
  }
420
- function Se(e) {
421
- var t = "", n = O();
422
- return n && (n = o(n.type)) && (t = `
630
+ function ke(e) {
631
+ var r = "", a = o();
632
+ return a && (a = t(a.type)) && (r = `
423
633
 
424
- Check the render method of \`` + n + "`."), t || (e = o(e)) && (t = `
634
+ Check the render method of \`` + a + "`."), r || (e = t(e)) && (r = `
425
635
 
426
- Check the top-level render call using <` + e + ">."), t;
636
+ Check the top-level render call using <` + e + ">."), r;
427
637
  }
428
- var ke = Oe, p = Symbol.for("react.transitional.element"), Pe = 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"), Re = Symbol.for("react.offscreen"), D = Symbol.iterator, _e = Symbol.for("react.client.reference"), b = ke.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, ee = Object.prototype.hasOwnProperty, T = Object.assign, Ae = Symbol.for("react.client.reference"), U = Array.isArray, S = 0, oe, te, ne, re, ae, ie, le;
429
- r.__reactDisabledLog = !0;
430
- var z, ue, H = !1, V = new (typeof WeakMap == "function" ? WeakMap : Map)(), xe = Symbol.for("react.client.reference"), se, ce = {}, fe = {}, de = {};
431
- R.Fragment = N, R.jsx = function(e, t, n, u, d) {
432
- return L(e, t, n, !1, u, d);
433
- }, R.jsxs = function(e, t, n, u, d) {
434
- return L(e, t, n, !0, u, d);
638
+ var _e = Be, z = Symbol.for("react.transitional.element"), Ae = Symbol.for("react.portal"), Y = Symbol.for("react.fragment"), ne = Symbol.for("react.strict_mode"), te = Symbol.for("react.profiler"), re = Symbol.for("react.consumer"), ae = Symbol.for("react.context"), I = Symbol.for("react.forward_ref"), U = Symbol.for("react.suspense"), W = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), Oe = Symbol.for("react.offscreen"), ie = Symbol.iterator, xe = Symbol.for("react.client.reference"), y = _e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, le = Object.prototype.hasOwnProperty, R = Object.assign, je = Symbol.for("react.client.reference"), H = Array.isArray, A = 0, ue, se, ce, de, fe, ge, ve;
639
+ s.__reactDisabledLog = !0;
640
+ var F, Ee, q = !1, G = new (typeof WeakMap == "function" ? WeakMap : Map)(), Ne = Symbol.for("react.client.reference"), pe, me = {}, we = {}, Te = {};
641
+ j.Fragment = Y, j.jsx = function(e, r, a, f, T) {
642
+ return K(e, r, a, !1, f, T);
643
+ }, j.jsxs = function(e, r, a, f, T) {
644
+ return K(e, r, a, !0, f, T);
435
645
  };
436
- }()), R;
437
- }
438
- var Ee;
439
- function Me() {
440
- return Ee || (Ee = 1, process.env.NODE_ENV === "production" ? A.exports = pe() : A.exports = Ne()), A.exports;
646
+ }()), j;
441
647
  }
442
- var Be = Me();
443
- function Ye(o) {
444
- return o && o.__esModule && Object.prototype.hasOwnProperty.call(o, "default") ? o.default : o;
648
+ var Ce;
649
+ function Je() {
650
+ return Ce || (Ce = 1, process.env.NODE_ENV === "production" ? M.exports = qe() : M.exports = Ge()), M.exports;
445
651
  }
446
- var We = function(o, l, c) {
447
- var r = document.head || document.getElementsByTagName("head")[0], i = document.createElement("script");
448
- typeof l == "function" && (c = l, l = {}), l = l || {}, c = c || function() {
449
- }, 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);
450
- var f = "onload" in i ? me : Ue;
451
- f(i, c), i.onload || me(i, c), r.appendChild(i);
452
- };
453
- function $e(o, l) {
454
- for (var c in l)
455
- o.setAttribute(c, l[c]);
456
- }
457
- function me(o, l) {
458
- o.onload = function() {
459
- this.onerror = this.onload = null, l(null, o);
460
- }, o.onerror = function() {
461
- this.onerror = this.onload = null, l(new Error("Failed to load " + this.src), o);
462
- };
463
- }
464
- function Ue(o, l) {
465
- o.onreadystatechange = function() {
466
- this.readyState != "complete" && this.readyState != "loaded" || (this.onreadystatechange = null, l(null, o));
467
- };
468
- }
469
- const be = /* @__PURE__ */ Ye(We), J = "https://d5aoblv5p04cg.cloudfront.net/editor-3/loader/build.js", ze = "https://d5aoblv5p04cg.cloudfront.net/develop/loader/build.js", He = "https://d5aoblv5p04cg.cloudfront.net/staging/loader/build.js";
470
- function Ve(o = "production") {
471
- switch (o) {
472
- case "dev":
473
- return ze;
474
- case "staging":
475
- return He;
476
- case "production":
477
- return J;
478
- default:
479
- return `https://d10h8ga60f7b91.cloudfront.net/preview-app-${o}/loader/build.js`;
480
- }
481
- }
482
- async function qe(o) {
483
- return new Promise((l, c) => {
484
- be(J, (r) => {
485
- r !== null && c(r), window.TopolPlugin.init(o), l(!0);
486
- });
487
- });
488
- }
489
- const we = {
490
- init: (o, l) => new Promise((c, r) => {
491
- const i = Ve(l == null ? void 0 : l.stage);
492
- be(i, async (f) => {
493
- if (f !== null) {
494
- if (i !== J)
495
- try {
496
- return await qe(o), c(!0);
497
- } catch (g) {
498
- r(g);
499
- }
500
- r(f);
501
- }
502
- window.TopolPlugin.init(o), c(!0);
503
- });
504
- }),
505
- save: () => {
506
- window.TopolPlugin.save();
507
- },
508
- load: (o) => {
509
- window.TopolPlugin.load(o);
510
- },
511
- togglePreview: () => {
512
- window.TopolPlugin.togglePreview();
513
- },
514
- togglePreviewSize: () => {
515
- window.TopolPlugin.togglePreviewSize();
516
- },
517
- chooseFile: (o) => {
518
- window.TopolPlugin.chooseFile(o);
519
- },
520
- undo: () => {
521
- window.TopolPlugin.undo();
522
- },
523
- redo: () => {
524
- window.TopolPlugin.redo();
525
- },
526
- destroy: () => {
527
- window.TopolPlugin.destroy();
528
- },
529
- setSavedBlocks: (o) => {
530
- window.TopolPlugin.setSavedBlocks(o);
531
- },
532
- setPreviewHTML: (o) => {
533
- window.TopolPlugin.setPreviewHTML(o);
534
- },
535
- createNotification: (o) => {
536
- window.TopolPlugin.createNotification(o);
537
- },
538
- setActiveMembers: (o) => {
539
- window.TopolPlugin.setActiveMembers(o);
540
- },
541
- changeEmailToMobile: () => {
542
- window.TopolPlugin.changeEmailToMobile();
543
- },
544
- changeEmailToDesktop: () => {
545
- window.TopolPlugin.changeEmailToDesktop();
546
- },
547
- toggleBlocksAndStructuresVisibility: () => {
548
- window.TopolPlugin.toggleBlocksAndStructuresVisibility();
549
- },
550
- updateCustomBlockContent: (o) => {
551
- window.TopolPlugin.updateCustomBlockContent(o);
552
- },
553
- refreshComments: (o) => {
554
- window.TopolPlugin.refreshComments(o);
555
- },
556
- refreshSyncedRows: () => {
557
- window.TopolPlugin.refreshSyncedRows();
558
- },
559
- openPremadeTemplatesSelection: () => {
560
- window.TopolPlugin.openPremadeTemplatesSelection();
561
- },
562
- updateApiAuthorizationHeader: (o) => {
563
- window.TopolPlugin.updateApiAuthorizationHeader(o);
564
- },
565
- setTemplateName: (o) => {
566
- window.TopolPlugin.setTemplateName(o);
567
- }
568
- }, Fe = "editor";
569
- let q = !1, F = !1;
570
- function Le(o) {
571
- const l = () => {
572
- const c = {
573
- onSave(r, i) {
574
- o.onSave !== void 0 && o.onSave(r, i);
652
+ var Q = Je();
653
+ const ye = "topol-email-editor-id";
654
+ function Xe(t) {
655
+ const d = _(!1), g = _(!1), s = _(t);
656
+ return s.current = t, D(() => d.current ? void 0 : (d.current = !0, (async () => {
657
+ const E = s.current, v = {
658
+ onSave(l, o) {
659
+ var n, i;
660
+ (i = (n = s.current).onSave) == null || i.call(n, l, o);
575
661
  },
576
- onSaveAndClose(r, i) {
577
- o.onSaveAndClose !== void 0 && o.onSaveAndClose(r, i);
662
+ onSaveAndClose(l, o) {
663
+ var n, i;
664
+ (i = (n = s.current).onSaveAndClose) == null || i.call(n, l, o);
578
665
  },
579
- onTestSend(r, i, f) {
580
- o.onTestSend !== void 0 && o.onTestSend(r, i, f);
666
+ onTestSend(l, o, n) {
667
+ var i, w;
668
+ (w = (i = s.current).onTestSend) == null || w.call(i, l, o, n);
581
669
  },
582
670
  onOpenFileManager() {
583
- o.onOpenFileManager !== void 0 && o.onOpenFileManager();
671
+ var l, o;
672
+ (o = (l = s.current).onOpenFileManager) == null || o.call(l);
584
673
  },
585
674
  onLoaded() {
586
- o.onLoaded !== void 0 && o.onLoaded();
675
+ var l, o;
676
+ (o = (l = s.current).onLoaded) == null || o.call(l);
587
677
  },
588
- onBlockSave(r) {
589
- o.onBlockSave !== void 0 && o.onBlockSave(r);
678
+ onBlockSave(l) {
679
+ var o, n;
680
+ (n = (o = s.current).onBlockSave) == null || n.call(o, l);
590
681
  },
591
- onBlockRemove(r) {
592
- o.onBlockRemove !== void 0 && o.onBlockRemove(r);
682
+ onBlockRemove(l) {
683
+ var o, n;
684
+ (n = (o = s.current).onBlockRemove) == null || n.call(o, l);
593
685
  },
594
- onBlockEdit(r) {
595
- o.onBlockEdit !== void 0 && o.onBlockEdit(r);
686
+ onBlockEdit(l) {
687
+ var o, n;
688
+ (n = (o = s.current).onBlockEdit) == null || n.call(o, l);
596
689
  },
597
690
  onInit() {
598
- o.onInit !== void 0 && o.onInit(), q = !1, F = !0;
691
+ var l, o;
692
+ (o = (l = s.current).onInit) == null || o.call(l), g.current = !0;
599
693
  },
600
- onUndoChange(r) {
601
- o.onUndoChange !== void 0 && o.onUndoChange(r);
694
+ onUndoChange(l) {
695
+ var o, n;
696
+ (n = (o = s.current).onUndoChange) == null || n.call(o, l);
602
697
  },
603
- onRedoChange(r) {
604
- o.onRedoChange !== void 0 && o.onRedoChange(r);
698
+ onRedoChange(l) {
699
+ var o, n;
700
+ (n = (o = s.current).onRedoChange) == null || n.call(o, l);
605
701
  },
606
- onPreview(r) {
607
- o.onPreview !== void 0 && o.onPreview(r);
702
+ onPreview(l) {
703
+ var o, n;
704
+ (n = (o = s.current).onPreview) == null || n.call(o, l);
608
705
  },
609
- onAlert(r) {
610
- o.onAlert !== void 0 && o.onAlert(r);
706
+ onAlert(l) {
707
+ var o, n;
708
+ (n = (o = s.current).onAlert) == null || n.call(o, l);
611
709
  },
612
710
  onClose() {
613
- o.onClose !== void 0 && o.onClose();
711
+ var l, o;
712
+ (o = (l = s.current).onClose) == null || o.call(l);
713
+ },
714
+ onBannerClick(l, o) {
715
+ var n, i;
716
+ (i = (n = s.current).onBannerClick) == null || i.call(n, l, o);
614
717
  },
615
- onEdittedWithoutSaveChanged(r) {
616
- o.onEdittedWithoutSaveChanged !== void 0 && o.onEdittedWithoutSaveChanged(r);
718
+ onEdittedWithoutSaveChanged(l) {
719
+ var o, n;
720
+ (n = (o = s.current).onEdittedWithoutSaveChanged) == null || n.call(o, l);
617
721
  },
618
- onOpenCustomBlockDialog(r) {
619
- o.onOpenCustomBlockDialog !== void 0 && o.onOpenCustomBlockDialog(r);
722
+ onOpenCustomBlockDialog(l) {
723
+ var o, n;
724
+ (n = (o = s.current).onOpenCustomBlockDialog) == null || n.call(o, l);
620
725
  },
621
- onTemplateRename(r) {
622
- o.onTemplateRename !== void 0 && o.onTemplateRename(r);
726
+ onTemplateRename(l) {
727
+ var o, n;
728
+ (n = (o = s.current).onTemplateRename) == null || n.call(o, l);
623
729
  },
624
- updateTestingEmailAddresses(r) {
625
- o.updateTestingEmailAddresses !== void 0 && o.updateTestingEmailAddresses(r);
730
+ updateTestingEmailAddresses(l) {
731
+ var o, n;
732
+ (n = (o = s.current).updateTestingEmailAddresses) == null || n.call(o, l);
626
733
  },
627
- onError(r, i) {
628
- o.onError !== void 0 && o.onError(r, i);
734
+ onError(l, o) {
735
+ var n, i;
736
+ (i = (n = s.current).onError) == null || i.call(n, l, o);
629
737
  }
738
+ }, m = {
739
+ id: "#" + ye,
740
+ ...E.options,
741
+ callbacks: v
630
742
  };
631
- return { id: "#" + Fe, ...o.options, callbacks: { ...c } };
632
- };
633
- return je(() => (q || (async () => {
634
- q = !0;
635
- const r = l();
636
- await we.init(r, { stage: o.stage || "production" });
637
- })(), () => {
638
- F && (we.destroy(), F = !1);
639
- }), []), /* @__PURE__ */ Be.jsx(
743
+ await X.init(m, { stage: E.stage || "production" });
744
+ })().catch((E) => {
745
+ var v, m;
746
+ (m = (v = s.current).onError) == null || m.call(v, "init", (E == null ? void 0 : E.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] EmailEditor initialization failed:", E);
747
+ }), () => {
748
+ g.current && (X.destroy(), g.current = !1), d.current = !1;
749
+ }), []), /* @__PURE__ */ Q.jsx(
750
+ "div",
751
+ {
752
+ id: ye,
753
+ style: { position: "absolute", height: "100vh", width: "100%" }
754
+ }
755
+ );
756
+ }
757
+ const Re = "topol-landing-page-editor-id", De = Me((t, d) => {
758
+ const g = _(!1), s = _(null), u = _(t);
759
+ return u.current = t, Le(d, () => ({
760
+ load(E) {
761
+ var v;
762
+ (v = s.current) == null || v.load(E);
763
+ }
764
+ })), D(() => g.current ? void 0 : (g.current = !0, (async () => {
765
+ const v = u.current, m = {
766
+ onSave(o, n) {
767
+ var i, w;
768
+ (w = (i = u.current).onSave) == null || w.call(i, o, n);
769
+ },
770
+ onSaveAndClose(o, n) {
771
+ var i, w;
772
+ (w = (i = u.current).onSaveAndClose) == null || w.call(i, o, n);
773
+ },
774
+ onOpenFileManager() {
775
+ var o, n;
776
+ (n = (o = u.current).onOpenFileManager) == null || n.call(o);
777
+ },
778
+ onLoaded() {
779
+ var o, n;
780
+ (n = (o = u.current).onLoaded) == null || n.call(o);
781
+ },
782
+ onBlockSave(o) {
783
+ var n, i;
784
+ (i = (n = u.current).onBlockSave) == null || i.call(n, o);
785
+ },
786
+ onBlockRemove(o) {
787
+ var n, i;
788
+ (i = (n = u.current).onBlockRemove) == null || i.call(n, o);
789
+ },
790
+ onBlockEdit(o) {
791
+ var n, i;
792
+ (i = (n = u.current).onBlockEdit) == null || i.call(n, o);
793
+ },
794
+ onInit() {
795
+ var o, n;
796
+ (n = (o = u.current).onInit) == null || n.call(o);
797
+ },
798
+ onClose() {
799
+ var o, n;
800
+ (n = (o = u.current).onClose) == null || n.call(o);
801
+ },
802
+ onUndoChange(o) {
803
+ var n, i;
804
+ (i = (n = u.current).onUndoChange) == null || i.call(n, o);
805
+ },
806
+ onRedoChange(o) {
807
+ var n, i;
808
+ (i = (n = u.current).onRedoChange) == null || i.call(n, o);
809
+ },
810
+ onPreview(o) {
811
+ var n, i;
812
+ (i = (n = u.current).onPreview) == null || i.call(n, o);
813
+ },
814
+ onAlert(o) {
815
+ var n, i;
816
+ (i = (n = u.current).onAlert) == null || i.call(n, o);
817
+ },
818
+ onBannerClick(o, n) {
819
+ var i, w;
820
+ (w = (i = u.current).onBannerClick) == null || w.call(i, o, n);
821
+ },
822
+ onEdittedWithoutSaveChanged(o) {
823
+ var n, i;
824
+ (i = (n = u.current).onEdittedWithoutSaveChanged) == null || i.call(n, o);
825
+ },
826
+ onOpenCustomBlockDialog(o) {
827
+ var n, i;
828
+ (i = (n = u.current).onOpenCustomBlockDialog) == null || i.call(n, o);
829
+ },
830
+ onTemplateRename(o) {
831
+ var n, i;
832
+ (i = (n = u.current).onTemplateRename) == null || i.call(n, o);
833
+ },
834
+ onError(o, n) {
835
+ var i, w;
836
+ (w = (i = u.current).onError) == null || w.call(i, o, n);
837
+ }
838
+ }, l = await Fe.init({ config: v.options, ...m }, { stage: v.stage || "production" });
839
+ s.current = l, l.render("#" + Re);
840
+ })().catch((v) => {
841
+ var m, l;
842
+ (l = (m = u.current).onError) == null || l.call(m, "init", (v == null ? void 0 : v.message) || "Failed to initialize editor"), console.error("[@topol.io/editor-react] LandingPageEditor initialization failed:", v);
843
+ }), () => {
844
+ var v;
845
+ (v = s.current) == null || v.destroy(), s.current = null, g.current = !1;
846
+ }), []), /* @__PURE__ */ Q.jsx(
640
847
  "div",
641
848
  {
642
- id: "editor",
849
+ id: Re,
643
850
  style: { position: "absolute", height: "100vh", width: "100%" }
644
851
  }
645
852
  );
853
+ });
854
+ De.displayName = "LandingPageEditor";
855
+ function Ke(t) {
856
+ return D(() => {
857
+ console.warn("[@topol.io/editor-react] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.");
858
+ }, []), /* @__PURE__ */ Q.jsx(Xe, { ...t });
646
859
  }
647
860
  export {
648
- we as TopolPlugin,
649
- Le as default
861
+ X as CoreEmailEditor,
862
+ Fe as CoreLandingPageEditor,
863
+ Xe as EmailEditor,
864
+ De as LandingPageEditor,
865
+ Ke as TopolEditor,
866
+ Qe as TopolPlugin
650
867
  };