@topol.io/editor-vue 1.0.0-alpha.1 → 1.0.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,107 +1,89 @@
1
- <a href="https://topol.io" target="_blank">
2
- <img src="https://storage.googleapis.com/topolio17326/plugin-assets/6320/17326/topol-with-bg.png" alt="Tailwind CSS" width="400" height="120">
3
- </a>
1
+ # @topol.io/editor-vue — 1.x alpha
4
2
 
5
- ---
3
+ Vue 3 wrapper for Email Editor v4, from the 1.x alpha line onward.
6
4
 
7
- Easy and quick! Drag and drop HTML editor and builder for beautiful responsive email templates.
8
-
9
- # Documentation
10
-
11
- ## Installation
12
-
13
- Install Editor from NPM using:
14
-
15
- ```sh
16
- npm install @topol.io/editor-vue
17
-
18
- //or
19
-
20
- yarn add @topol.io/editor-vue
21
- ```
22
-
23
- ## Use in Component
24
-
25
- In your Vue component import and add the simplest options.
26
-
27
- For more options see the docs for [TopolOptions configuration](https://docs.topol.io/reference/topol-options.html)
28
-
29
- ```js
30
- import { TopolEditor } from '@topol.io/editor-vue';
31
-
32
- const customOptions = {
33
- authorize: {
34
- apiKey: 'YOUR_API_TOKEN',
35
- userId: 'some-user-id',
5
+ ```vue
6
+ <script setup lang="ts">
7
+ import { EmailEditor, type IEmailCallbacks, type IVueEmailOptions } from "@topol.io/editor-vue";
8
+ const options: IVueEmailOptions = {
9
+ authorize: { apiKey: "pk_your-key", entityId: "user-123" },
10
+ cloud: { enabled: true },
11
+ };
12
+ const callbacks: IEmailCallbacks = {
13
+ async getNonce() {
14
+ const response = await fetch("/api/topol/nonce", { method: "POST" });
15
+ if (!response.ok) throw new Error("Cloud authorization failed");
16
+ return (await response.json()).nonce;
36
17
  },
37
18
  };
19
+ </script>
20
+ <template>
21
+ <EmailEditor
22
+ :options="options"
23
+ :callbacks="callbacks"
24
+ @on-cloud-save="({ templateId }) => console.log(templateId)"
25
+ @on-editor-error="({ source, message }) => console.error(source, message)"
26
+ />
27
+ </template>
38
28
  ```
39
29
 
40
- ```html
41
- <TopolEditor :options="customOptions"></TopolEditor>
42
- ```
43
-
44
- ## Call Topol Plugin actions
45
-
46
- To call actions to the editor import:
47
-
48
- ```js
49
- import { TopolPlugin } from '@topol.io/editor-vue';
50
-
51
- TopolPlugin.save();
52
- ```
53
-
54
- For more TopolPlugin functions refer to the [TopolPlugin actions](https://www.npmjs.com/package/@topol.io/editor#call-topol-plugin-actions)
30
+ Use the **`callbacks` prop for `getNonce` and asynchronous persistence**:
31
+ `callbacks.onSave = async ({ json, html }) => { await persist(json, html); }`.
32
+ Vue event handlers do not return promises to the editor. Events remain available
33
+ for notifications, with the exact core object payloads. If both a callback and an
34
+ event listener are provided, the callback runs first and its result is returned.
35
+
36
+ `@ready="editor => ..."` receives the instance. A component template ref exposes
37
+ `getEditor()`. `@on-save-and-close` is registered only when explicitly supplied;
38
+ without it or `callbacks.onSaveAndClose`, the runtime's default save-and-close works.
39
+ `getNonce` is a function callback only, never an event.
40
+
41
+ The exposed `load()` and `save()` of `LandingPageEditor` return Promises: `save()`
42
+ settles once the save has finished and rejects with `err.code === "SAVE_IN_PROGRESS"`
43
+ while another save runs. The exposed `getEditor()` returns the instance for its other
44
+ methods. `LandingPageEditor` takes the same `callbacks` prop (`ILandingPageCallbacks`):
45
+ pass `getNonce` there to turn nonce authentication on, and async `onSave` /
46
+ `onSaveAndClose` / `onEditorClose` handlers the editor should wait for.
47
+ It also has `@ready`, `loader-url` and a container without a fixed `id`, so several
48
+ editors can share a page; `class` and `style` fall through to the container.
49
+ `CoreEmailEditor` exposes the core v4 factory.
50
+
51
+ `options` contains the v4 configuration (`IEmailConfig`). A `getNonce` callback that
52
+ fetches a fresh `nc_` token from your application's authenticated backend enables
53
+ nonce authentication on its own; Cloud additionally requires it. Never put an `sk_`
54
+ secret in browser code. See the core package README for nonce authentication, Cloud
55
+ feature options, the Countdown block (`countdown`; see the
56
+ [option reference](https://docs.topol.io/email-editor/reference/topol-options#countdown))
57
+ and all v4 renames.
58
+
59
+ Configuration and the presence of callback handlers are captured on mount. Remount
60
+ with a new key to change them; existing callback functions read their latest values.
61
+ `ready` means the iframe has rendered; `onInit` reports editor authentication.
62
+ Set the container's height. Each component owns its own instance and destroys it
63
+ on unmount, including when initialization is still pending.
64
+
65
+ Use `loaderUrl` for an explicit v4 local/preview loader. A numeric `stage` selects
66
+ a PR preview. The `TopolEditor` alias is removed; import `EmailEditor`.
67
+
68
+ ## Running the example against deployed Cloud
69
+
70
+ Merge `.env.example` into `example/.env.local` (Vite's development root). Set
71
+ `VITE_TOPOL_CLOUD_PUBLIC_KEY` and `VITE_TOPOL_CLOUD_SECRET_KEY` to a matching `pk_` / `sk_`
72
+ credential pair registered in the deployed backend, then start or restart Vite:
55
73
 
56
- <br>
57
-
58
- ## Editor Events
59
-
60
- The callbacks from editor are received as component events.
61
-
62
- ```html
63
- <TopolEditor
64
- :options="customOptions"
65
- @onSave="handleOnSave"
66
- ></TopolEditor>
74
+ ```sh
75
+ pnpm --filter @topol.io/editor-vue dev
67
76
  ```
68
77
 
69
- ### List of all editor events
70
-
71
- | Event | Description |
72
- | ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
73
- | `@onSave` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save) |
74
- | `@onSaveAndClose` | Returns object which contains html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-save-and-close) |
75
- | `@onTestSend` | Returns object which contains email, html and json of the template [more info](https://docs.topol.io/guide/callbacks.html#on-test-email-send) |
76
- | `@onOpenFileManager` | When user clicks file manager open [more info](https://docs.topol.io/guide/custom-filemanager.html#onopenfilemanager) |
77
- | `@onLoaded` | After editor template is loaded using `TopolPlugin.load()` [more info](https://docs.topol.io/guide/callbacks.html#on-loaded) |
78
- | `@onInit` | When editor inits [more info](https://docs.topol.io/guide/callbacks.html#on-init) |
79
- | `@onBlockSave` | When user saves block in editor, returns object of type ISavedBlock [more info](https://docs.topol.io/guide/callbacks.html#on-block-save) |
80
- | `@onBlockRemove` | When user removes saved block, returns id of saved block to be removed [more info](https://docs.topol.io/guide/callbacks.html#on-block-remove) |
81
- | `@onBlockEdit` | When user edits saved block, returns id of saved block to be updated [more info](https://docs.topol.io/guide/callbacks.html#on-block-edit) |
82
- | `@onUndoChange` | When user clicks undo button, retunrs number of steps user undone [more info](https://docs.topol.io/guide/callbacks.html#on-undo-change) |
83
- | `@onRedoChange` | When user clicks redo button, retunrs number of steps user redone [more info](https://docs.topol.io/guide/callbacks.html#on-redo-change) |
84
- | `@onPreview` | When user switches to preview [more info](https://docs.topol.io/guide/callbacks.html#on-preview) |
85
- | `@onAlert` | When alert appears in editor [more info](https://docs.topol.io/guide/callbacks.html#on-alert) |
86
- | `@onClose` | When close is click inside WindowBar [more info](https://docs.topol.io/guide/top-bar.html#window-bar) |
87
- | `@onEdittedWithoutSaveChanged` | When user is about to leave an editor with unsaved changes [more info](https://docs.topol.io/guide/disable-before-leaving-modal.html#before-exit-modal-when-user-has-unsaved-changes) |
88
- | `@onOpenCustomBlockDialog` | When user clicks on the open dialog in custom block [more info](https://docs.topol.io/guide/custom-block.html#inserting-custom-html-in-custom-dialog-component) |
89
- | `@onTemplateRename` | When user clicks on the pencil icon next to the template name [more info](https://docs.topol.io/guide/rename-template.html#rename-template) |
90
- | `@updateTestingEmailAddresses` | When user edits the email list in preview [more info](https://docs.topol.io/guide/sending-a-test-email.html#managing-saving-emails-yourself) |
91
- | `@onError` | When an error that cannot be handled happened in the editor [more info](https://docs.topol.io/guide/callbacks.html#onerror) |
92
-
93
- <br>
94
-
95
- ## TypeScript
96
-
97
- Topol Editor provides full TypeScript integration and exports all necessary types.
98
-
99
- ```vue
100
- <script setup lang="ts">
101
- import {
102
- ITopolOptions,
103
- INotification,
104
- ISavedBlock,
105
- } from '@topol.io/editor-vue';
106
- </script>
107
- ```
78
+ The example uses the production v4 loader at
79
+ `https://v4.email-assets.topol.io/loader/build.js` and defaults to user `42`
80
+ (override with `VITE_TOPOL_CLOUD_USER_ID`). Its `callbacks.getNonce` calls
81
+ `POST https://9wh997i15a.execute-api.eu-central-1.amazonaws.com/auth/nonce`
82
+ directly from the browser. This testing-only example exposes the secret in the
83
+ frontend; use test credentials and do not deploy it. No local nonce endpoint or
84
+ Cloud backend is needed; a made-up nonce or the
85
+ local seed credentials cannot substitute for credentials registered in that backend.
86
+
87
+ The editor loader must use the same backend as `VITE_TOPOL_CLOUD_API_URL`.
88
+ `VITE_TOPOL_API_KEY` remains the landing-page example's key. Deployed
89
+ integrations need an authenticated backend that derives the user from the session.
@@ -1,226 +1,330 @@
1
- import { EmailEditor as v, LandingPageEditor as B } from "@topol.io/editor";
2
- import { EmailEditor as I, LandingPageEditor as D, default as M } from "@topol.io/editor";
3
- import { defineComponent as s, onMounted as g, onBeforeUnmount as u, createElementBlock as k, openBlock as p, ref as S, createBlock as O } from "vue";
4
- const C = "topol-email-editor-id", R = /* @__PURE__ */ s({
1
+ import { EmailEditor as D, LandingPageEditor as R } from "@topol.io/editor";
2
+ import { EmailEditor as H, LandingPageEditor as N } from "@topol.io/editor";
3
+ import { defineComponent as L, getCurrentInstance as T, ref as w, onMounted as A, onBeforeUnmount as U, createElementBlock as P, openBlock as B, shallowRef as y } from "vue";
4
+ const _ = /* @__PURE__ */ L({
5
5
  __name: "EmailEditor",
6
6
  props: {
7
7
  options: {},
8
- stage: { default: "production" }
8
+ callbacks: {},
9
+ stage: { default: "production" },
10
+ loaderUrl: {}
9
11
  },
10
- emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "updateTestingEmailAddresses", "onError"],
11
- setup(l, { emit: r }) {
12
- const d = l, e = r, i = () => ({
13
- onSave(o, n) {
14
- e("onSave", { json: o, html: n });
15
- },
16
- onSaveAndClose(o, n) {
17
- e("onSaveAndClose", { json: o, html: n });
18
- },
19
- onTestSend(o, n, m) {
20
- e("onTestSend", { email: o, json: n, html: m });
21
- },
22
- onOpenFileManager() {
23
- e("onOpenFileManager");
24
- },
25
- onLoaded() {
26
- e("onLoaded");
27
- },
28
- onBlockSave(o) {
29
- e("onBlockSave", o);
30
- },
31
- onBlockRemove(o) {
32
- e("onBlockRemove", o);
33
- },
34
- onBlockEdit(o) {
35
- e("onBlockEdit", o);
36
- },
37
- onInit() {
38
- e("onInit");
39
- },
40
- onUndoChange(o) {
41
- e("onUndoChange", o);
42
- },
43
- onRedoChange(o) {
44
- e("onRedoChange", o);
45
- },
46
- onPreview(o) {
47
- e("onPreview", o);
48
- },
49
- onAlert(o) {
50
- e("onAlert", o);
51
- },
52
- onClose() {
53
- e("onClose");
54
- },
55
- onBannerClick(o, n) {
56
- e("onBannerClick", { json: o, html: n });
57
- },
58
- onEdittedWithoutSaveChanged(o) {
59
- e("onEdittedWithoutSaveChanged", o);
60
- },
61
- onOpenCustomBlockDialog(o) {
62
- e("onOpenCustomBlockDialog", o);
63
- },
64
- onTemplateRename(o) {
65
- e("onTemplateRename", o);
66
- },
67
- updateTestingEmailAddresses(o) {
68
- e("updateTestingEmailAddresses", o);
69
- },
70
- onError(o, n) {
71
- e("onError", { type: o, message: n });
72
- }
73
- });
74
- return g(async () => {
12
+ emits: ["ready", "onSave", "onSaveAndClose", "onTestSend", "onBannerClick", "onOpenFileManager", "onLoaded", "onSavedSectionSave", "onSavedSectionRemove", "onSavedSectionEdit", "onImageDelete", "onInit", "onUndoChange", "onRedoChange", "onPreview", "onPreviewClose", "onAlert", "onEditorClose", "onUnsavedChangesChange", "onEdittedWithoutSaveChanged", "onHiddenElementsVisibilityChange", "onBlocksAndStructuresVisibilityChange", "onOpenCustomBlockDialog", "onTemplateRename", "onTemplateUpdated", "onTestingEmailsChange", "updateTestingEmailAddresses", "onEditorError", "onLanguageCreated", "onLanguageDeleted", "onLanguageSelected", "onPrimaryLanguageChanged", "onGetMutations", "onCloudSave", "onCloudTemplateChange"],
13
+ setup(S, { expose: k, emit: p }) {
14
+ const a = S, r = p, h = T(), m = w();
15
+ let u, v = !1;
16
+ k({ getEditor: () => u ?? null });
17
+ const i = (l) => {
18
+ var n, t, e;
19
+ const d = `on${l[0].toUpperCase()}${l.slice(1)}`;
20
+ return !!((n = a.callbacks) != null && n[l]) || !!((t = h.vnode.props) != null && t[d]) || !!((e = h.vnode.props) != null && e[`${d}Once`]);
21
+ }, b = (l) => {
22
+ var n, t;
23
+ if (v) return;
24
+ const d = { source: "integration", message: l instanceof Error ? l.message : String(l), detail: l };
25
+ i("onEditorError") || console.error("[@topol.io/editor-vue] EmailEditor failed:", l), (t = (n = a.callbacks) == null ? void 0 : n.onEditorError) == null || t.call(n, d), r("onEditorError", d);
26
+ };
27
+ return A(async () => {
28
+ var d;
29
+ const l = {
30
+ onSave: i("onSave") ? (n) => {
31
+ var e, o;
32
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onSave) == null ? void 0 : o.call(e, n);
33
+ return r("onSave", n), t;
34
+ } : void 0,
35
+ onSaveAndClose: i("onSaveAndClose") ? (n) => {
36
+ var e, o;
37
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onSaveAndClose) == null ? void 0 : o.call(e, n);
38
+ return r("onSaveAndClose", n), t;
39
+ } : void 0,
40
+ onTestSend: i("onTestSend") ? (n) => {
41
+ var e, o;
42
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onTestSend) == null ? void 0 : o.call(e, n);
43
+ return r("onTestSend", n), t;
44
+ } : void 0,
45
+ onBannerClick: i("onBannerClick") ? (n) => {
46
+ var e, o;
47
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onBannerClick) == null ? void 0 : o.call(e, n);
48
+ return r("onBannerClick", n), t;
49
+ } : void 0,
50
+ onOpenFileManager: i("onOpenFileManager") ? () => {
51
+ var t, e;
52
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onOpenFileManager) == null ? void 0 : e.call(t);
53
+ return r("onOpenFileManager"), n;
54
+ } : void 0,
55
+ onLoaded: i("onLoaded") ? () => {
56
+ var t, e;
57
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onLoaded) == null ? void 0 : e.call(t);
58
+ return r("onLoaded"), n;
59
+ } : void 0,
60
+ onSavedSectionSave: i("onSavedSectionSave") ? (n) => {
61
+ var e, o;
62
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onSavedSectionSave) == null ? void 0 : o.call(e, n);
63
+ return r("onSavedSectionSave", n), t;
64
+ } : void 0,
65
+ onSavedSectionRemove: i("onSavedSectionRemove") ? (n) => {
66
+ var e, o;
67
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onSavedSectionRemove) == null ? void 0 : o.call(e, n);
68
+ return r("onSavedSectionRemove", n), t;
69
+ } : void 0,
70
+ onSavedSectionEdit: i("onSavedSectionEdit") ? (n) => {
71
+ var e, o;
72
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onSavedSectionEdit) == null ? void 0 : o.call(e, n);
73
+ return r("onSavedSectionEdit", n), t;
74
+ } : void 0,
75
+ onImageDelete: i("onImageDelete") ? (n) => {
76
+ var e, o;
77
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onImageDelete) == null ? void 0 : o.call(e, n);
78
+ return r("onImageDelete", n), t;
79
+ } : void 0,
80
+ onInit: i("onInit") ? () => {
81
+ var t, e;
82
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onInit) == null ? void 0 : e.call(t);
83
+ return r("onInit"), n;
84
+ } : void 0,
85
+ onUndoChange: i("onUndoChange") ? (n) => {
86
+ var e, o;
87
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onUndoChange) == null ? void 0 : o.call(e, n);
88
+ return r("onUndoChange", n), t;
89
+ } : void 0,
90
+ onRedoChange: i("onRedoChange") ? (n) => {
91
+ var e, o;
92
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onRedoChange) == null ? void 0 : o.call(e, n);
93
+ return r("onRedoChange", n), t;
94
+ } : void 0,
95
+ onPreview: i("onPreview") ? (n) => {
96
+ var e, o;
97
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onPreview) == null ? void 0 : o.call(e, n);
98
+ return r("onPreview", n), t;
99
+ } : void 0,
100
+ onPreviewClose: i("onPreviewClose") ? () => {
101
+ var t, e;
102
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onPreviewClose) == null ? void 0 : e.call(t);
103
+ return r("onPreviewClose"), n;
104
+ } : void 0,
105
+ onAlert: i("onAlert") ? (n) => {
106
+ var e, o;
107
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onAlert) == null ? void 0 : o.call(e, n);
108
+ return r("onAlert", n), t;
109
+ } : void 0,
110
+ onEditorClose: i("onEditorClose") ? () => {
111
+ var t, e;
112
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onEditorClose) == null ? void 0 : e.call(t);
113
+ return r("onEditorClose"), n;
114
+ } : void 0,
115
+ onUnsavedChangesChange: i("onUnsavedChangesChange") ? (n) => {
116
+ var e, o;
117
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onUnsavedChangesChange) == null ? void 0 : o.call(e, n);
118
+ return r("onUnsavedChangesChange", n), t;
119
+ } : void 0,
120
+ onEdittedWithoutSaveChanged: i("onEdittedWithoutSaveChanged") ? (n) => {
121
+ var e, o;
122
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onEdittedWithoutSaveChanged) == null ? void 0 : o.call(e, n);
123
+ return r("onEdittedWithoutSaveChanged", n), t;
124
+ } : void 0,
125
+ onHiddenElementsVisibilityChange: i("onHiddenElementsVisibilityChange") ? (n) => {
126
+ var e, o;
127
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onHiddenElementsVisibilityChange) == null ? void 0 : o.call(e, n);
128
+ return r("onHiddenElementsVisibilityChange", n), t;
129
+ } : void 0,
130
+ onBlocksAndStructuresVisibilityChange: i("onBlocksAndStructuresVisibilityChange") ? (n) => {
131
+ var e, o;
132
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onBlocksAndStructuresVisibilityChange) == null ? void 0 : o.call(e, n);
133
+ return r("onBlocksAndStructuresVisibilityChange", n), t;
134
+ } : void 0,
135
+ onOpenCustomBlockDialog: i("onOpenCustomBlockDialog") ? (n) => {
136
+ var e, o;
137
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onOpenCustomBlockDialog) == null ? void 0 : o.call(e, n);
138
+ return r("onOpenCustomBlockDialog", n), t;
139
+ } : void 0,
140
+ onTemplateRename: i("onTemplateRename") ? (n) => {
141
+ var e, o;
142
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onTemplateRename) == null ? void 0 : o.call(e, n);
143
+ return r("onTemplateRename", n), t;
144
+ } : void 0,
145
+ onTemplateUpdated: i("onTemplateUpdated") ? () => {
146
+ var t, e;
147
+ const n = (e = (t = a.callbacks) == null ? void 0 : t.onTemplateUpdated) == null ? void 0 : e.call(t);
148
+ return r("onTemplateUpdated"), n;
149
+ } : void 0,
150
+ onTestingEmailsChange: i("onTestingEmailsChange") ? (n) => {
151
+ var e, o;
152
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onTestingEmailsChange) == null ? void 0 : o.call(e, n);
153
+ return r("onTestingEmailsChange", n), t;
154
+ } : void 0,
155
+ updateTestingEmailAddresses: i("updateTestingEmailAddresses") ? (n) => {
156
+ var e, o;
157
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.updateTestingEmailAddresses) == null ? void 0 : o.call(e, n);
158
+ return r("updateTestingEmailAddresses", n), t;
159
+ } : void 0,
160
+ onEditorError: i("onEditorError") ? (n) => {
161
+ var e, o;
162
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onEditorError) == null ? void 0 : o.call(e, n);
163
+ return r("onEditorError", n), t;
164
+ } : void 0,
165
+ onLanguageCreated: i("onLanguageCreated") ? (n) => {
166
+ var e, o;
167
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onLanguageCreated) == null ? void 0 : o.call(e, n);
168
+ return r("onLanguageCreated", n), t;
169
+ } : void 0,
170
+ onLanguageDeleted: i("onLanguageDeleted") ? (n) => {
171
+ var e, o;
172
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onLanguageDeleted) == null ? void 0 : o.call(e, n);
173
+ return r("onLanguageDeleted", n), t;
174
+ } : void 0,
175
+ onLanguageSelected: i("onLanguageSelected") ? (n) => {
176
+ var e, o;
177
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onLanguageSelected) == null ? void 0 : o.call(e, n);
178
+ return r("onLanguageSelected", n), t;
179
+ } : void 0,
180
+ onPrimaryLanguageChanged: i("onPrimaryLanguageChanged") ? (n) => {
181
+ var e, o;
182
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onPrimaryLanguageChanged) == null ? void 0 : o.call(e, n);
183
+ return r("onPrimaryLanguageChanged", n), t;
184
+ } : void 0,
185
+ onGetMutations: i("onGetMutations") ? (n) => {
186
+ var e, o;
187
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onGetMutations) == null ? void 0 : o.call(e, n);
188
+ return r("onGetMutations", n), t;
189
+ } : void 0,
190
+ getNonce: (d = a.callbacks) != null && d.getNonce ? () => a.callbacks.getNonce() : void 0,
191
+ onCloudSave: i("onCloudSave") ? (n) => {
192
+ var e, o;
193
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onCloudSave) == null ? void 0 : o.call(e, n);
194
+ return r("onCloudSave", n), t;
195
+ } : void 0,
196
+ onCloudTemplateChange: i("onCloudTemplateChange") ? (n) => {
197
+ var e, o;
198
+ const t = (o = (e = a.callbacks) == null ? void 0 : e.onCloudTemplateChange) == null ? void 0 : o.call(e, n);
199
+ return r("onCloudTemplateChange", n), t;
200
+ } : void 0
201
+ };
75
202
  try {
76
- const o = {
77
- id: "#" + C,
78
- ...d.options,
79
- callbacks: i()
80
- };
81
- await v.init(o, { stage: d.stage });
82
- } catch (o) {
83
- const n = o instanceof Error ? o.message : "Failed to initialize editor";
84
- e("onError", { type: "init", message: n }), console.error("[@topol.io/editor-vue] EmailEditor initialization failed:", o);
203
+ const n = await D.init({ config: a.options, ...l }, { stage: a.stage, loaderUrl: a.loaderUrl });
204
+ if (v) {
205
+ await n.destroy();
206
+ return;
207
+ }
208
+ u = n;
209
+ try {
210
+ await n.render(m.value);
211
+ } catch (t) {
212
+ throw await n.destroy(), u = void 0, t;
213
+ }
214
+ v || r("ready", n);
215
+ } catch (n) {
216
+ b(n);
85
217
  }
86
- }), u(() => {
87
- v.destroy();
88
- }), (o, n) => (p(), k("div", {
89
- id: C,
90
- style: { position: "absolute", width: "100%", height: "100vh" }
91
- }));
218
+ }), U(() => {
219
+ v = !0;
220
+ const l = u;
221
+ u = void 0, l == null || l.destroy().catch((d) => console.warn("[@topol.io/editor-vue] EmailEditor cleanup failed:", d));
222
+ }), (l, d) => (B(), P("div", {
223
+ ref_key: "container",
224
+ ref: m,
225
+ style: { width: "100%", height: "100vh" }
226
+ }, null, 512));
92
227
  }
93
- }), E = "topol-landing-page-editor-id", f = /* @__PURE__ */ s({
228
+ }), M = /* @__PURE__ */ L({
94
229
  __name: "LandingPageEditor",
95
230
  props: {
96
231
  options: {},
97
- stage: { default: "production" }
232
+ callbacks: {},
233
+ stage: { default: "production" },
234
+ loaderUrl: {}
98
235
  },
99
- emits: ["onSave", "onSaveAndClose", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "onError"],
100
- setup(l, { expose: r, emit: d }) {
101
- const e = l, i = d, o = S(null), n = () => ({
102
- onSave(t, a) {
103
- i("onSave", { json: t, html: a });
104
- },
105
- onSaveAndClose(t, a) {
106
- i("onSaveAndClose", { json: t, html: a });
107
- },
108
- onOpenFileManager() {
109
- i("onOpenFileManager");
110
- },
111
- onLoaded() {
112
- i("onLoaded");
113
- },
114
- onBlockSave(t) {
115
- i("onBlockSave", t);
116
- },
117
- onBlockRemove(t) {
118
- i("onBlockRemove", t);
119
- },
120
- onBlockEdit(t) {
121
- i("onBlockEdit", t);
122
- },
123
- onInit() {
124
- i("onInit");
125
- },
126
- onClose() {
127
- i("onClose");
128
- },
129
- onUndoChange(t) {
130
- i("onUndoChange", t);
131
- },
132
- onRedoChange(t) {
133
- i("onRedoChange", t);
134
- },
135
- onPreview(t) {
136
- i("onPreview", t);
137
- },
138
- onAlert(t) {
139
- i("onAlert", t);
140
- },
141
- onBannerClick(t, a) {
142
- i("onBannerClick", { json: t, html: a });
143
- },
144
- onEdittedWithoutSaveChanged(t) {
145
- i("onEdittedWithoutSaveChanged", t);
146
- },
147
- onOpenCustomBlockDialog(t) {
148
- i("onOpenCustomBlockDialog", t);
149
- },
150
- onTemplateRename(t) {
151
- i("onTemplateRename", t);
152
- },
153
- onError(t, a) {
154
- i("onError", { type: t, message: a });
155
- }
156
- });
157
- return g(async () => {
236
+ emits: ["ready", "onSave", "onSaveAndClose", "onOpenFileManager", "onImageDelete", "onLoaded", "onInit", "onUndoChange", "onRedoChange", "onPreview", "onPreviewClose", "onAlert", "onEditorClose", "onUnsavedChangesChange", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "onEditorError"],
237
+ setup(S, { expose: k, emit: p }) {
238
+ const a = S, r = p, h = [
239
+ "onSave",
240
+ "onSaveAndClose",
241
+ "onOpenFileManager",
242
+ "onImageDelete",
243
+ "onLoaded",
244
+ "onInit",
245
+ "onUndoChange",
246
+ "onRedoChange",
247
+ "onPreview",
248
+ "onPreviewClose",
249
+ "onAlert",
250
+ "onEditorClose",
251
+ "onUnsavedChangesChange",
252
+ "onEdittedWithoutSaveChanged",
253
+ "onOpenCustomBlockDialog",
254
+ "onTemplateRename",
255
+ "onEditorError"
256
+ ], m = w(), u = y(null), v = T(), i = (o) => {
257
+ var g;
258
+ if (typeof ((g = a.callbacks) == null ? void 0 : g[o]) == "function") return !0;
259
+ const c = v == null ? void 0 : v.vnode.props;
260
+ if (!c) return !1;
261
+ const s = "on" + o.charAt(0).toUpperCase() + o.slice(1);
262
+ return [s, s + "Once"].some((C) => typeof c[C] == "function" || Array.isArray(c[C]));
263
+ }, b = () => {
264
+ var c;
265
+ const o = {};
266
+ for (const s of h)
267
+ i(s) && (o[s] = (g) => {
268
+ var E, f;
269
+ const C = (f = (E = a.callbacks) == null ? void 0 : E[s]) == null ? void 0 : f.call(E, g);
270
+ return g === void 0 ? r(s) : r(s, g), C;
271
+ });
272
+ return typeof ((c = a.callbacks) == null ? void 0 : c.getNonce) == "function" && (o.getNonce = () => a.callbacks.getNonce()), o;
273
+ };
274
+ let l = !1;
275
+ async function d(o) {
276
+ var c;
277
+ if (o)
278
+ try {
279
+ await ((c = o.destroy) == null ? void 0 : c.call(o));
280
+ } catch (s) {
281
+ console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:", s);
282
+ }
283
+ }
284
+ return A(async () => {
285
+ var o, c;
158
286
  try {
159
- const t = await B.init({ config: e.options, ...n() }, { stage: e.stage });
160
- o.value = t, t.render("#" + E);
161
- } catch (t) {
162
- const a = t instanceof Error ? t.message : "Failed to initialize editor";
163
- i("onError", { type: "init", message: a }), console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:", t);
287
+ const s = await R.init({ config: a.options, ...b() }, { stage: a.stage, loaderUrl: a.loaderUrl });
288
+ if (l) {
289
+ await d(s);
290
+ return;
291
+ }
292
+ u.value = s;
293
+ try {
294
+ await s.render(m.value);
295
+ } catch (g) {
296
+ throw u.value === s && (u.value = null), await d(s), g;
297
+ }
298
+ l || r("ready", s);
299
+ } catch (s) {
300
+ if (l) return;
301
+ const C = { source: "integration", message: s instanceof Error ? s.message : "Failed to initialize editor", detail: s };
302
+ (c = (o = a.callbacks) == null ? void 0 : o.onEditorError) == null || c.call(o, C), r("onEditorError", C), console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:", s);
164
303
  }
165
- }), u(() => {
166
- var t;
167
- (t = o.value) == null || t.destroy();
168
- }), r({
169
- load: (t) => {
170
- var a;
171
- (a = o.value) == null || a.load(t);
172
- },
173
- save: () => {
174
- var t;
175
- (t = o.value) == null || t.save();
176
- }
177
- }), (t, a) => (p(), k("div", {
178
- id: E,
179
- style: { position: "absolute", width: "100%", height: "100vh" }
180
- }));
181
- }
182
- }), L = /* @__PURE__ */ s({
183
- __name: "TopolEditor",
184
- props: {
185
- options: {},
186
- stage: { default: "production" }
187
- },
188
- emits: ["onSave", "onSaveAndClose", "onTestSend", "onOpenFileManager", "onLoaded", "onBlockSave", "onBlockRemove", "onBlockEdit", "onInit", "onClose", "onUndoChange", "onRedoChange", "onPreview", "onAlert", "onBannerClick", "onEdittedWithoutSaveChanged", "onOpenCustomBlockDialog", "onTemplateRename", "updateTestingEmailAddresses", "onError"],
189
- setup(l, { emit: r }) {
190
- const d = l, e = r;
191
- return g(() => {
192
- console.warn("[@topol.io/editor-vue] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.");
193
- }), (i, o) => (p(), O(R, {
194
- options: d.options,
195
- stage: d.stage,
196
- onOnSave: o[0] || (o[0] = (n) => e("onSave", n)),
197
- onOnSaveAndClose: o[1] || (o[1] = (n) => e("onSaveAndClose", n)),
198
- onOnTestSend: o[2] || (o[2] = (n) => e("onTestSend", n)),
199
- onOnOpenFileManager: o[3] || (o[3] = () => e("onOpenFileManager")),
200
- onOnLoaded: o[4] || (o[4] = () => e("onLoaded")),
201
- onOnBlockSave: o[5] || (o[5] = (n) => e("onBlockSave", n)),
202
- onOnBlockRemove: o[6] || (o[6] = (n) => e("onBlockRemove", n)),
203
- onOnBlockEdit: o[7] || (o[7] = (n) => e("onBlockEdit", n)),
204
- onOnInit: o[8] || (o[8] = () => e("onInit")),
205
- onOnClose: o[9] || (o[9] = () => e("onClose")),
206
- onOnUndoChange: o[10] || (o[10] = (n) => e("onUndoChange", n)),
207
- onOnRedoChange: o[11] || (o[11] = (n) => e("onRedoChange", n)),
208
- onOnPreview: o[12] || (o[12] = (n) => e("onPreview", n)),
209
- onOnAlert: o[13] || (o[13] = (n) => e("onAlert", n)),
210
- onOnBannerClick: o[14] || (o[14] = (n) => e("onBannerClick", n)),
211
- onOnEdittedWithoutSaveChanged: o[15] || (o[15] = (n) => e("onEdittedWithoutSaveChanged", n)),
212
- onOnOpenCustomBlockDialog: o[16] || (o[16] = (n) => e("onOpenCustomBlockDialog", n)),
213
- onOnTemplateRename: o[17] || (o[17] = (n) => e("onTemplateRename", n)),
214
- onUpdateTestingEmailAddresses: o[18] || (o[18] = (n) => e("updateTestingEmailAddresses", n)),
215
- onOnError: o[19] || (o[19] = (n) => e("onError", n))
216
- }, null, 8, ["options", "stage"]));
304
+ }), U(() => {
305
+ l = !0;
306
+ const o = u.value;
307
+ u.value = null, d(o);
308
+ }), k({
309
+ load: async (o) => {
310
+ var c;
311
+ await ((c = u.value) == null ? void 0 : c.load(o));
312
+ },
313
+ save: async () => {
314
+ var o;
315
+ await ((o = u.value) == null ? void 0 : o.save());
316
+ },
317
+ getEditor: () => u.value ?? null
318
+ }), (o, c) => (B(), P("div", {
319
+ ref_key: "container",
320
+ ref: m,
321
+ style: { width: "100%", height: "100vh" }
322
+ }, null, 512));
217
323
  }
218
324
  });
219
325
  export {
220
- I as CoreEmailEditor,
221
- D as CoreLandingPageEditor,
222
- R as EmailEditor,
223
- f as LandingPageEditor,
224
- L as TopolEditor,
225
- M as TopolPlugin
326
+ H as CoreEmailEditor,
327
+ N as CoreLandingPageEditor,
328
+ _ as EmailEditor,
329
+ M as LandingPageEditor
226
330
  };
@@ -0,0 +1 @@
1
+ (function(v,m){typeof exports=="object"&&typeof module<"u"?m(exports,require("@topol.io/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@topol.io/editor","vue"],m):(v=typeof globalThis<"u"?globalThis:v||self,m(v["topol-editor-vue"]={},v.TopolPlugin,v.Vue))})(this,function(v,m,c){"use strict";const P=c.defineComponent({__name:"EmailEditor",props:{options:{},callbacks:{},stage:{default:"production"},loaderUrl:{}},emits:["ready","onSave","onSaveAndClose","onTestSend","onBannerClick","onOpenFileManager","onLoaded","onSavedSectionSave","onSavedSectionRemove","onSavedSectionEdit","onImageDelete","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onUnsavedChangesChange","onEdittedWithoutSaveChanged","onHiddenElementsVisibilityChange","onBlocksAndStructuresVisibilityChange","onOpenCustomBlockDialog","onTemplateRename","onTemplateUpdated","onTestingEmailsChange","updateTestingEmailAddresses","onEditorError","onLanguageCreated","onLanguageDeleted","onLanguageSelected","onPrimaryLanguageChanged","onGetMutations","onCloudSave","onCloudTemplateChange"],setup(f,{expose:b,emit:L}){const a=f,r=L,k=c.getCurrentInstance(),S=c.ref();let g,h=!1;b({getEditor:()=>g??null});const i=l=>{var n,t,e;const u=`on${l[0].toUpperCase()}${l.slice(1)}`;return!!((n=a.callbacks)!=null&&n[l])||!!((t=k.vnode.props)!=null&&t[u])||!!((e=k.vnode.props)!=null&&e[`${u}Once`])},T=l=>{var n,t;if(h)return;const u={source:"integration",message:l instanceof Error?l.message:String(l),detail:l};i("onEditorError")||console.error("[@topol.io/editor-vue] EmailEditor failed:",l),(t=(n=a.callbacks)==null?void 0:n.onEditorError)==null||t.call(n,u),r("onEditorError",u)};return c.onMounted(async()=>{var u;const l={onSave:i("onSave")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onSave)==null?void 0:o.call(e,n);return r("onSave",n),t}:void 0,onSaveAndClose:i("onSaveAndClose")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onSaveAndClose)==null?void 0:o.call(e,n);return r("onSaveAndClose",n),t}:void 0,onTestSend:i("onTestSend")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onTestSend)==null?void 0:o.call(e,n);return r("onTestSend",n),t}:void 0,onBannerClick:i("onBannerClick")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onBannerClick)==null?void 0:o.call(e,n);return r("onBannerClick",n),t}:void 0,onOpenFileManager:i("onOpenFileManager")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onOpenFileManager)==null?void 0:e.call(t);return r("onOpenFileManager"),n}:void 0,onLoaded:i("onLoaded")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onLoaded)==null?void 0:e.call(t);return r("onLoaded"),n}:void 0,onSavedSectionSave:i("onSavedSectionSave")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onSavedSectionSave)==null?void 0:o.call(e,n);return r("onSavedSectionSave",n),t}:void 0,onSavedSectionRemove:i("onSavedSectionRemove")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onSavedSectionRemove)==null?void 0:o.call(e,n);return r("onSavedSectionRemove",n),t}:void 0,onSavedSectionEdit:i("onSavedSectionEdit")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onSavedSectionEdit)==null?void 0:o.call(e,n);return r("onSavedSectionEdit",n),t}:void 0,onImageDelete:i("onImageDelete")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onImageDelete)==null?void 0:o.call(e,n);return r("onImageDelete",n),t}:void 0,onInit:i("onInit")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onInit)==null?void 0:e.call(t);return r("onInit"),n}:void 0,onUndoChange:i("onUndoChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onUndoChange)==null?void 0:o.call(e,n);return r("onUndoChange",n),t}:void 0,onRedoChange:i("onRedoChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onRedoChange)==null?void 0:o.call(e,n);return r("onRedoChange",n),t}:void 0,onPreview:i("onPreview")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onPreview)==null?void 0:o.call(e,n);return r("onPreview",n),t}:void 0,onPreviewClose:i("onPreviewClose")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onPreviewClose)==null?void 0:e.call(t);return r("onPreviewClose"),n}:void 0,onAlert:i("onAlert")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onAlert)==null?void 0:o.call(e,n);return r("onAlert",n),t}:void 0,onEditorClose:i("onEditorClose")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onEditorClose)==null?void 0:e.call(t);return r("onEditorClose"),n}:void 0,onUnsavedChangesChange:i("onUnsavedChangesChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onUnsavedChangesChange)==null?void 0:o.call(e,n);return r("onUnsavedChangesChange",n),t}:void 0,onEdittedWithoutSaveChanged:i("onEdittedWithoutSaveChanged")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onEdittedWithoutSaveChanged)==null?void 0:o.call(e,n);return r("onEdittedWithoutSaveChanged",n),t}:void 0,onHiddenElementsVisibilityChange:i("onHiddenElementsVisibilityChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onHiddenElementsVisibilityChange)==null?void 0:o.call(e,n);return r("onHiddenElementsVisibilityChange",n),t}:void 0,onBlocksAndStructuresVisibilityChange:i("onBlocksAndStructuresVisibilityChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onBlocksAndStructuresVisibilityChange)==null?void 0:o.call(e,n);return r("onBlocksAndStructuresVisibilityChange",n),t}:void 0,onOpenCustomBlockDialog:i("onOpenCustomBlockDialog")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onOpenCustomBlockDialog)==null?void 0:o.call(e,n);return r("onOpenCustomBlockDialog",n),t}:void 0,onTemplateRename:i("onTemplateRename")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onTemplateRename)==null?void 0:o.call(e,n);return r("onTemplateRename",n),t}:void 0,onTemplateUpdated:i("onTemplateUpdated")?()=>{var t,e;const n=(e=(t=a.callbacks)==null?void 0:t.onTemplateUpdated)==null?void 0:e.call(t);return r("onTemplateUpdated"),n}:void 0,onTestingEmailsChange:i("onTestingEmailsChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onTestingEmailsChange)==null?void 0:o.call(e,n);return r("onTestingEmailsChange",n),t}:void 0,updateTestingEmailAddresses:i("updateTestingEmailAddresses")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.updateTestingEmailAddresses)==null?void 0:o.call(e,n);return r("updateTestingEmailAddresses",n),t}:void 0,onEditorError:i("onEditorError")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onEditorError)==null?void 0:o.call(e,n);return r("onEditorError",n),t}:void 0,onLanguageCreated:i("onLanguageCreated")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onLanguageCreated)==null?void 0:o.call(e,n);return r("onLanguageCreated",n),t}:void 0,onLanguageDeleted:i("onLanguageDeleted")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onLanguageDeleted)==null?void 0:o.call(e,n);return r("onLanguageDeleted",n),t}:void 0,onLanguageSelected:i("onLanguageSelected")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onLanguageSelected)==null?void 0:o.call(e,n);return r("onLanguageSelected",n),t}:void 0,onPrimaryLanguageChanged:i("onPrimaryLanguageChanged")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onPrimaryLanguageChanged)==null?void 0:o.call(e,n);return r("onPrimaryLanguageChanged",n),t}:void 0,onGetMutations:i("onGetMutations")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onGetMutations)==null?void 0:o.call(e,n);return r("onGetMutations",n),t}:void 0,getNonce:(u=a.callbacks)!=null&&u.getNonce?()=>a.callbacks.getNonce():void 0,onCloudSave:i("onCloudSave")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onCloudSave)==null?void 0:o.call(e,n);return r("onCloudSave",n),t}:void 0,onCloudTemplateChange:i("onCloudTemplateChange")?n=>{var e,o;const t=(o=(e=a.callbacks)==null?void 0:e.onCloudTemplateChange)==null?void 0:o.call(e,n);return r("onCloudTemplateChange",n),t}:void 0};try{const n=await m.EmailEditor.init({config:a.options,...l},{stage:a.stage,loaderUrl:a.loaderUrl});if(h){await n.destroy();return}g=n;try{await n.render(S.value)}catch(t){throw await n.destroy(),g=void 0,t}h||r("ready",n)}catch(n){T(n)}}),c.onBeforeUnmount(()=>{h=!0;const l=g;g=void 0,l==null||l.destroy().catch(u=>console.warn("[@topol.io/editor-vue] EmailEditor cleanup failed:",u))}),(l,u)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"container",ref:S,style:{width:"100%",height:"100vh"}},null,512))}}),A=c.defineComponent({__name:"LandingPageEditor",props:{options:{},callbacks:{},stage:{default:"production"},loaderUrl:{}},emits:["ready","onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onUnsavedChangesChange","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],setup(f,{expose:b,emit:L}){const a=f,r=L,k=["onSave","onSaveAndClose","onOpenFileManager","onImageDelete","onLoaded","onInit","onUndoChange","onRedoChange","onPreview","onPreviewClose","onAlert","onEditorClose","onUnsavedChangesChange","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onEditorError"],S=c.ref(),g=c.shallowRef(null),h=c.getCurrentInstance(),i=o=>{var C;if(typeof((C=a.callbacks)==null?void 0:C[o])=="function")return!0;const d=h==null?void 0:h.vnode.props;if(!d)return!1;const s="on"+o.charAt(0).toUpperCase()+o.slice(1);return[s,s+"Once"].some(E=>typeof d[E]=="function"||Array.isArray(d[E]))},T=()=>{var d;const o={};for(const s of k)i(s)&&(o[s]=C=>{var p,w;const E=(w=(p=a.callbacks)==null?void 0:p[s])==null?void 0:w.call(p,C);return C===void 0?r(s):r(s,C),E});return typeof((d=a.callbacks)==null?void 0:d.getNonce)=="function"&&(o.getNonce=()=>a.callbacks.getNonce()),o};let l=!1;async function u(o){var d;if(o)try{await((d=o.destroy)==null?void 0:d.call(o))}catch(s){console.warn("[@topol.io/editor-vue] LandingPageEditor destroy failed:",s)}}return c.onMounted(async()=>{var o,d;try{const s=await m.LandingPageEditor.init({config:a.options,...T()},{stage:a.stage,loaderUrl:a.loaderUrl});if(l){await u(s);return}g.value=s;try{await s.render(S.value)}catch(C){throw g.value===s&&(g.value=null),await u(s),C}l||r("ready",s)}catch(s){if(l)return;const E={source:"integration",message:s instanceof Error?s.message:"Failed to initialize editor",detail:s};(d=(o=a.callbacks)==null?void 0:o.onEditorError)==null||d.call(o,E),r("onEditorError",E),console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:",s)}}),c.onBeforeUnmount(()=>{l=!0;const o=g.value;g.value=null,u(o)}),b({load:async o=>{var d;await((d=g.value)==null?void 0:d.load(o))},save:async()=>{var o;await((o=g.value)==null?void 0:o.save())},getEditor:()=>g.value??null}),(o,d)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"container",ref:S,style:{width:"100%",height:"100vh"}},null,512))}});Object.defineProperty(v,"CoreEmailEditor",{enumerable:!0,get:()=>m.EmailEditor}),Object.defineProperty(v,"CoreLandingPageEditor",{enumerable:!0,get:()=>m.LandingPageEditor}),v.EmailEditor=P,v.LandingPageEditor=A,Object.defineProperty(v,Symbol.toStringTag,{value:"Module"})});
@@ -1,15 +1,163 @@
1
- import { type IStage } from '@topol.io/editor';
2
- import type { IVueEmailOptions } from './types';
1
+ import type { IEmailCallbacks, IEmailEditorInstance, IStage, IEmailErrorPayload } from "@topol.io/editor";
2
+ import type { IVueEmailOptions } from "./types";
3
3
  type __VLS_Props = {
4
4
  options: IVueEmailOptions;
5
+ callbacks?: IEmailCallbacks;
5
6
  stage?: IStage;
7
+ loaderUrl?: string;
6
8
  };
7
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- [x: string]: any;
9
- } & {
10
- [x: string]: any;
9
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {
10
+ getEditor: () => IEmailEditorInstance | null;
11
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
12
+ onSave: (payload: import("@topol.io/editor").IEmailSavePayload) => any;
13
+ onSaveAndClose: (payload: import("@topol.io/editor").IEmailSavePayload) => any;
14
+ onTestSend: (payload: import("@topol.io/editor").IEmailTestSendPayload) => any;
15
+ onBannerClick: (payload: {
16
+ json: unknown;
17
+ html: unknown;
18
+ }) => any;
19
+ onOpenFileManager: () => any;
20
+ onLoaded: () => any;
21
+ onSavedSectionSave: (payload: {
22
+ section: import("@topol.io/editor").ISavedSectionDraft;
23
+ }) => any;
24
+ onSavedSectionRemove: (payload: {
25
+ id: number;
26
+ }) => any;
27
+ onSavedSectionEdit: (payload: {
28
+ id: number;
29
+ }) => any;
30
+ onImageDelete: (payload: {
31
+ items: import("@topol.io/editor").IEmailDeletedItem[];
32
+ }) => any;
33
+ onInit: () => any;
34
+ onUndoChange: (payload: {
35
+ count: number;
36
+ }) => any;
37
+ onRedoChange: (payload: {
38
+ count: number;
39
+ }) => any;
40
+ onPreview: (payload: {
41
+ html: unknown;
42
+ }) => any;
43
+ onPreviewClose: () => any;
44
+ onAlert: (payload: {
45
+ notification: import("@topol.io/editor").INotification;
46
+ }) => any;
47
+ onEditorClose: () => any;
48
+ onUnsavedChangesChange: (payload: {
49
+ hasUnsavedChanges: boolean;
50
+ }) => any;
51
+ onEdittedWithoutSaveChanged: (payload: {
52
+ value: boolean;
53
+ }) => any;
54
+ onHiddenElementsVisibilityChange: (payload: {
55
+ visible: boolean;
56
+ }) => any;
57
+ onBlocksAndStructuresVisibilityChange: (payload: {
58
+ value: boolean;
59
+ }) => any;
60
+ onOpenCustomBlockDialog: (payload: {
61
+ block: unknown;
62
+ }) => any;
63
+ onTemplateRename: (payload: {
64
+ name: string;
65
+ }) => any;
66
+ onTemplateUpdated: () => any;
67
+ onTestingEmailsChange: (payload: {
68
+ emails: string[];
69
+ }) => any;
70
+ updateTestingEmailAddresses: (payload: {
71
+ emails: string[];
72
+ }) => any;
73
+ onEditorError: (payload: IEmailErrorPayload) => any;
74
+ onLanguageCreated: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
75
+ onLanguageDeleted: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
76
+ onLanguageSelected: (payload: {
77
+ code: string;
78
+ }) => any;
79
+ onPrimaryLanguageChanged: (payload: import("@topol.io/editor").ILanguageChangePayload) => any;
80
+ onGetMutations: (payload: {
81
+ mutations: import("@topol.io/editor").ILanguageMutation[];
82
+ }) => any;
83
+ onCloudSave: (payload: import("@topol.io/editor").ICloudSavePayload) => any;
84
+ onCloudTemplateChange: (payload: import("@topol.io/editor").ICloudTemplateChangePayload) => any;
85
+ ready: (editor: IEmailEditorInstance) => any;
11
86
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
87
+ onOnSave?: ((payload: import("@topol.io/editor").IEmailSavePayload) => any) | undefined;
88
+ onOnSaveAndClose?: ((payload: import("@topol.io/editor").IEmailSavePayload) => any) | undefined;
89
+ onOnTestSend?: ((payload: import("@topol.io/editor").IEmailTestSendPayload) => any) | undefined;
90
+ onOnBannerClick?: ((payload: {
91
+ json: unknown;
92
+ html: unknown;
93
+ }) => any) | undefined;
94
+ onOnOpenFileManager?: (() => any) | undefined;
95
+ onOnLoaded?: (() => any) | undefined;
96
+ onOnSavedSectionSave?: ((payload: {
97
+ section: import("@topol.io/editor").ISavedSectionDraft;
98
+ }) => any) | undefined;
99
+ onOnSavedSectionRemove?: ((payload: {
100
+ id: number;
101
+ }) => any) | undefined;
102
+ onOnSavedSectionEdit?: ((payload: {
103
+ id: number;
104
+ }) => any) | undefined;
105
+ onOnImageDelete?: ((payload: {
106
+ items: import("@topol.io/editor").IEmailDeletedItem[];
107
+ }) => any) | undefined;
108
+ onOnInit?: (() => any) | undefined;
109
+ onOnUndoChange?: ((payload: {
110
+ count: number;
111
+ }) => any) | undefined;
112
+ onOnRedoChange?: ((payload: {
113
+ count: number;
114
+ }) => any) | undefined;
115
+ onOnPreview?: ((payload: {
116
+ html: unknown;
117
+ }) => any) | undefined;
118
+ onOnPreviewClose?: (() => any) | undefined;
119
+ onOnAlert?: ((payload: {
120
+ notification: import("@topol.io/editor").INotification;
121
+ }) => any) | undefined;
122
+ onOnEditorClose?: (() => any) | undefined;
123
+ onOnUnsavedChangesChange?: ((payload: {
124
+ hasUnsavedChanges: boolean;
125
+ }) => any) | undefined;
126
+ onOnEdittedWithoutSaveChanged?: ((payload: {
127
+ value: boolean;
128
+ }) => any) | undefined;
129
+ onOnHiddenElementsVisibilityChange?: ((payload: {
130
+ visible: boolean;
131
+ }) => any) | undefined;
132
+ onOnBlocksAndStructuresVisibilityChange?: ((payload: {
133
+ value: boolean;
134
+ }) => any) | undefined;
135
+ onOnOpenCustomBlockDialog?: ((payload: {
136
+ block: unknown;
137
+ }) => any) | undefined;
138
+ onOnTemplateRename?: ((payload: {
139
+ name: string;
140
+ }) => any) | undefined;
141
+ onOnTemplateUpdated?: (() => any) | undefined;
142
+ onOnTestingEmailsChange?: ((payload: {
143
+ emails: string[];
144
+ }) => any) | undefined;
145
+ onUpdateTestingEmailAddresses?: ((payload: {
146
+ emails: string[];
147
+ }) => any) | undefined;
148
+ onOnEditorError?: ((payload: IEmailErrorPayload) => any) | undefined;
149
+ onOnLanguageCreated?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
150
+ onOnLanguageDeleted?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
151
+ onOnLanguageSelected?: ((payload: {
152
+ code: string;
153
+ }) => any) | undefined;
154
+ onOnPrimaryLanguageChanged?: ((payload: import("@topol.io/editor").ILanguageChangePayload) => any) | undefined;
155
+ onOnGetMutations?: ((payload: {
156
+ mutations: import("@topol.io/editor").ILanguageMutation[];
157
+ }) => any) | undefined;
158
+ onOnCloudSave?: ((payload: import("@topol.io/editor").ICloudSavePayload) => any) | undefined;
159
+ onOnCloudTemplateChange?: ((payload: import("@topol.io/editor").ICloudTemplateChangePayload) => any) | undefined;
160
+ onReady?: ((editor: IEmailEditorInstance) => any) | undefined;
13
161
  }>, {
14
162
  stage: IStage;
15
163
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -1,12 +1,21 @@
1
- import { type IStage } from '@topol.io/editor';
2
- import type { IVueLandingPageOptions } from './types';
1
+ import { type ILandingPageCallbacks, type ILandingPageEditorInstance, type IStage } from "@topol.io/editor";
2
+ import type { IVueLandingPageOptions } from "./types";
3
3
  type __VLS_Props = {
4
4
  options: IVueLandingPageOptions;
5
+ /**
6
+ * Callbacks as functions, for the ones whose result the editor uses: `getNonce` (the only
7
+ * way to pass it), and an async `onSave` / `onSaveAndClose` / `onEditorClose` the editor
8
+ * should wait for. A callback given here and its event (`@on-save`) both fire.
9
+ */
10
+ callbacks?: ILandingPageCallbacks;
5
11
  stage?: IStage;
12
+ /** Explicit loader URL, e.g. a deployed preview or a local build. One loader URL per page. */
13
+ loaderUrl?: string;
6
14
  };
7
15
  declare const _default: import("vue").DefineComponent<__VLS_Props, {
8
- load: (template: unknown) => void;
9
- save: () => void;
16
+ load: (template: unknown) => Promise<void>;
17
+ save: () => Promise<void>;
18
+ getEditor: () => ILandingPageEditorInstance | null;
10
19
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
11
20
  [x: string]: any;
12
21
  } & {
@@ -7,7 +7,7 @@
7
7
  * import { EmailEditor, type IVueEmailOptions } from '@topol.io/editor-vue';
8
8
  *
9
9
  * const options: IVueEmailOptions = {
10
- * authorize: { apiKey: 'your-key', userId: 'user-123' },
10
+ * authorize: { apiKey: 'your-key', entityId: 'user-123' },
11
11
  * };
12
12
  * </script>
13
13
  *
@@ -22,7 +22,7 @@
22
22
  * import { LandingPageEditor, type IVueLandingPageOptions } from '@topol.io/editor-vue';
23
23
  *
24
24
  * const options: IVueLandingPageOptions = {
25
- * authorize: { apiKey: 'your-key', userId: 'user-123' },
25
+ * authorize: { apiKey: 'your-key', entityId: 'user-123' },
26
26
  * };
27
27
  * </script>
28
28
  *
@@ -31,12 +31,8 @@
31
31
  * </template>
32
32
  * ```
33
33
  */
34
- export { default as TopolPlugin, EmailEditor as CoreEmailEditor, LandingPageEditor as CoreLandingPageEditor } from '@topol.io/editor';
35
- export { default as EmailEditor } from './EmailEditor.vue';
36
- export { default as LandingPageEditor } from './LandingPageEditor.vue';
37
- /**
38
- * @deprecated Use EmailEditor instead. TopolEditor is an alias for backwards compatibility.
39
- */
40
- export { default as TopolEditor } from './TopolEditor.vue';
41
- export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from '@topol.io/editor';
42
- export type { IVueEmailOptions, IVueLandingPageOptions, IVueOptions } from './types';
34
+ export { EmailEditor as CoreEmailEditor, LandingPageEditor as CoreLandingPageEditor } from "@topol.io/editor";
35
+ export { default as EmailEditor } from "./EmailEditor.vue";
36
+ export { default as LandingPageEditor } from "./LandingPageEditor.vue";
37
+ export type { IVueEmailOptions, IVueLandingPageOptions } from "./types";
38
+ export type { IEmailOptions, IEmailConfig, IEmailCallbacks, IEmailEditorInstance, IEmailEditorPluginOptions, IEmailSavePayload, IEmailErrorPayload, IEmailTestSendPayload, IEmailDeletedItem, IUpdateTemplateOptions, ILanguageMutation, ILanguageChangePayload, ILandingPageOptions, ILandingPageConfig, ILandingPageCallbacks, ILandingPageEditorInstance, ILandingPageEditorPluginOptions, ILandingPageSavePayload, ILandingPageErrorPayload, ILandingPageDeletedItem, IStage, EditorErrorSource, INonceAuthCallbacks, IAuthorize, EmailEditorShortcut, LandingPageEditorShortcut, INotification, ICloudOptions, ICloudFeatures, ICloudCallbacks, ICloudSavePayload, ICloudTemplateChangePayload, ICountdownOptions, ICountdownDefaultColors, ICountdownDateMergeTag, ISavedSection, ISavedSectionDraft, IPremadeSection, IPremadeSections, IPremadeSectionsOptions, } from "@topol.io/editor";
@@ -1,19 +1,11 @@
1
+ import type { IEmailConfig, ILandingPageConfig } from "@topol.io/editor";
1
2
  /**
2
- * Type re-exports from core package and Vue-specific types.
3
+ * The `options` prop of the EmailEditor component: the editor config.
4
+ * Callbacks are passed through the `callbacks` prop or as events.
3
5
  */
4
- export type { ITopolOptions, ILandingPageOptions, ILandingPageEditorInstance, IEmailCallbacks, ILandingPageCallbacks, ISaveData, IErrorData, ISendTestData, INotification, ISavedBlock, IStage, TopolSection, } from '@topol.io/editor';
5
- import type { ITopolOptions, ILandingPageOptions } from '@topol.io/editor';
6
+ export type IVueEmailOptions = IEmailConfig;
6
7
  /**
7
- * Vue-specific options for EmailEditor component.
8
- * Omits 'id' and 'callbacks' as they are handled internally by the Vue wrapper.
8
+ * The `options` prop of the LandingPageEditor component: the editor config.
9
+ * Callbacks are passed through the `callbacks` prop or as events.
9
10
  */
10
- export type IVueEmailOptions = Omit<ITopolOptions, 'id' | 'callbacks'>;
11
- /**
12
- * Vue-specific options for LandingPageEditor component.
13
- * Contains only the config options, as callbacks are handled as Vue emits.
14
- */
15
- export type IVueLandingPageOptions = ILandingPageOptions['config'];
16
- /**
17
- * @deprecated Use IVueEmailOptions instead.
18
- */
19
- export type IVueOptions = IVueEmailOptions;
11
+ export type IVueLandingPageOptions = ILandingPageConfig;
package/package.json CHANGED
@@ -14,7 +14,7 @@
14
14
  "author": "Topol.io",
15
15
  "homepage": "https://topol.io",
16
16
  "license": "Apache-2.0",
17
- "version": "1.0.0-alpha.1",
17
+ "version": "1.0.0-alpha.11",
18
18
  "type": "module",
19
19
  "files": [
20
20
  "dist"
@@ -25,11 +25,11 @@
25
25
  ".": {
26
26
  "types": "./dist/types/entry.d.ts",
27
27
  "import": "./dist/topol-editor-vue.es.js",
28
- "require": "./dist/topol-editor-vue.umd.js"
28
+ "require": "./dist/topol-editor-vue.umd.cjs"
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@topol.io/editor": "1.0.0-alpha.1"
32
+ "@topol.io/editor": "1.0.0-alpha.11"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "vue": "^3.2.25"
@@ -55,6 +55,10 @@
55
55
  "preview": "vite preview",
56
56
  "build:types": "vue-tsc -p tsconfig.prod.json",
57
57
  "test": "vitest run",
58
- "test:watch": "vitest"
58
+ "test:watch": "vitest",
59
+ "lint": "oxlint --deny-warnings .",
60
+ "lint:fix": "oxlint --fix --deny-warnings .",
61
+ "format": "oxfmt --write .",
62
+ "format:check": "oxfmt --check ."
59
63
  }
60
64
  }
@@ -1 +0,0 @@
1
- (function(d,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@topol.io/editor"),require("vue")):typeof define=="function"&&define.amd?define(["exports","@topol.io/editor","vue"],r):(d=typeof globalThis<"u"?globalThis:d||self,r(d["topol-editor-vue"]={},d.editor,d.Vue))})(this,function(d,r,a){"use strict";const m="topol-email-editor-id",C=a.defineComponent({__name:"EmailEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onClose","onUndoChange","onRedoChange","onPreview","onAlert","onBannerClick","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","updateTestingEmailAddresses","onError"],setup(p,{emit:g}){const s=p,e=g,i=()=>({onSave(o,n){e("onSave",{json:o,html:n})},onSaveAndClose(o,n){e("onSaveAndClose",{json:o,html:n})},onTestSend(o,n,u){e("onTestSend",{email:o,json:n,html:u})},onOpenFileManager(){e("onOpenFileManager")},onLoaded(){e("onLoaded")},onBlockSave(o){e("onBlockSave",o)},onBlockRemove(o){e("onBlockRemove",o)},onBlockEdit(o){e("onBlockEdit",o)},onInit(){e("onInit")},onUndoChange(o){e("onUndoChange",o)},onRedoChange(o){e("onRedoChange",o)},onPreview(o){e("onPreview",o)},onAlert(o){e("onAlert",o)},onClose(){e("onClose")},onBannerClick(o,n){e("onBannerClick",{json:o,html:n})},onEdittedWithoutSaveChanged(o){e("onEdittedWithoutSaveChanged",o)},onOpenCustomBlockDialog(o){e("onOpenCustomBlockDialog",o)},onTemplateRename(o){e("onTemplateRename",o)},updateTestingEmailAddresses(o){e("updateTestingEmailAddresses",o)},onError(o,n){e("onError",{type:o,message:n})}});return a.onMounted(async()=>{try{const o={id:"#"+m,...s.options,callbacks:i()};await r.EmailEditor.init(o,{stage:s.stage})}catch(o){const n=o instanceof Error?o.message:"Failed to initialize editor";e("onError",{type:"init",message:n}),console.error("[@topol.io/editor-vue] EmailEditor initialization failed:",o)}}),a.onBeforeUnmount(()=>{r.EmailEditor.destroy()}),(o,n)=>(a.openBlock(),a.createElementBlock("div",{id:m,style:{position:"absolute",width:"100%",height:"100vh"}}))}}),E="topol-landing-page-editor-id",v=a.defineComponent({__name:"LandingPageEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onClose","onUndoChange","onRedoChange","onPreview","onAlert","onBannerClick","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","onError"],setup(p,{expose:g,emit:s}){const e=p,i=s,o=a.ref(null),n=()=>({onSave(t,l){i("onSave",{json:t,html:l})},onSaveAndClose(t,l){i("onSaveAndClose",{json:t,html:l})},onOpenFileManager(){i("onOpenFileManager")},onLoaded(){i("onLoaded")},onBlockSave(t){i("onBlockSave",t)},onBlockRemove(t){i("onBlockRemove",t)},onBlockEdit(t){i("onBlockEdit",t)},onInit(){i("onInit")},onClose(){i("onClose")},onUndoChange(t){i("onUndoChange",t)},onRedoChange(t){i("onRedoChange",t)},onPreview(t){i("onPreview",t)},onAlert(t){i("onAlert",t)},onBannerClick(t,l){i("onBannerClick",{json:t,html:l})},onEdittedWithoutSaveChanged(t){i("onEdittedWithoutSaveChanged",t)},onOpenCustomBlockDialog(t){i("onOpenCustomBlockDialog",t)},onTemplateRename(t){i("onTemplateRename",t)},onError(t,l){i("onError",{type:t,message:l})}});return a.onMounted(async()=>{try{const t=await r.LandingPageEditor.init({config:e.options,...n()},{stage:e.stage});o.value=t,t.render("#"+E)}catch(t){const l=t instanceof Error?t.message:"Failed to initialize editor";i("onError",{type:"init",message:l}),console.error("[@topol.io/editor-vue] LandingPageEditor initialization failed:",t)}}),a.onBeforeUnmount(()=>{var t;(t=o.value)==null||t.destroy()}),g({load:t=>{var l;(l=o.value)==null||l.load(t)},save:()=>{var t;(t=o.value)==null||t.save()}}),(t,l)=>(a.openBlock(),a.createElementBlock("div",{id:E,style:{position:"absolute",width:"100%",height:"100vh"}}))}}),k=a.defineComponent({__name:"TopolEditor",props:{options:{},stage:{default:"production"}},emits:["onSave","onSaveAndClose","onTestSend","onOpenFileManager","onLoaded","onBlockSave","onBlockRemove","onBlockEdit","onInit","onClose","onUndoChange","onRedoChange","onPreview","onAlert","onBannerClick","onEdittedWithoutSaveChanged","onOpenCustomBlockDialog","onTemplateRename","updateTestingEmailAddresses","onError"],setup(p,{emit:g}){const s=p,e=g;return a.onMounted(()=>{console.warn("[@topol.io/editor-vue] TopolEditor is deprecated and will be removed in a future version. Please use EmailEditor instead.")}),(i,o)=>(a.openBlock(),a.createBlock(C,{options:s.options,stage:s.stage,onOnSave:o[0]||(o[0]=n=>e("onSave",n)),onOnSaveAndClose:o[1]||(o[1]=n=>e("onSaveAndClose",n)),onOnTestSend:o[2]||(o[2]=n=>e("onTestSend",n)),onOnOpenFileManager:o[3]||(o[3]=()=>e("onOpenFileManager")),onOnLoaded:o[4]||(o[4]=()=>e("onLoaded")),onOnBlockSave:o[5]||(o[5]=n=>e("onBlockSave",n)),onOnBlockRemove:o[6]||(o[6]=n=>e("onBlockRemove",n)),onOnBlockEdit:o[7]||(o[7]=n=>e("onBlockEdit",n)),onOnInit:o[8]||(o[8]=()=>e("onInit")),onOnClose:o[9]||(o[9]=()=>e("onClose")),onOnUndoChange:o[10]||(o[10]=n=>e("onUndoChange",n)),onOnRedoChange:o[11]||(o[11]=n=>e("onRedoChange",n)),onOnPreview:o[12]||(o[12]=n=>e("onPreview",n)),onOnAlert:o[13]||(o[13]=n=>e("onAlert",n)),onOnBannerClick:o[14]||(o[14]=n=>e("onBannerClick",n)),onOnEdittedWithoutSaveChanged:o[15]||(o[15]=n=>e("onEdittedWithoutSaveChanged",n)),onOnOpenCustomBlockDialog:o[16]||(o[16]=n=>e("onOpenCustomBlockDialog",n)),onOnTemplateRename:o[17]||(o[17]=n=>e("onTemplateRename",n)),onUpdateTestingEmailAddresses:o[18]||(o[18]=n=>e("updateTestingEmailAddresses",n)),onOnError:o[19]||(o[19]=n=>e("onError",n))},null,8,["options","stage"]))}});Object.defineProperty(d,"CoreEmailEditor",{enumerable:!0,get:()=>r.EmailEditor}),Object.defineProperty(d,"CoreLandingPageEditor",{enumerable:!0,get:()=>r.LandingPageEditor}),d.TopolPlugin=r,d.EmailEditor=C,d.LandingPageEditor=v,d.TopolEditor=k,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})});
@@ -1,16 +0,0 @@
1
- import { type IStage } from '@topol.io/editor';
2
- import type { IVueEmailOptions } from './types';
3
- type __VLS_Props = {
4
- options: IVueEmailOptions;
5
- stage?: IStage;
6
- };
7
- declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
8
- [x: string]: any;
9
- } & {
10
- [x: string]: any;
11
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
12
- [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
13
- }>, {
14
- stage: IStage;
15
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
- export default _default;