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