@weavour/editor 0.1.0 → 0.1.2
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 +10 -13
- package/dist/editor.js +9 -3
- package/dist/index.js +8 -2
- package/dist/legacy.js +9 -3
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
# Weavour editor SDKs
|
|
2
2
|
|
|
3
3
|
Embed the hosted Weavour email editor in your application. Your application owns
|
|
4
|
-
its users and sends the exported emails.
|
|
5
|
-
editor, rendering implementation and services are proprietary.
|
|
4
|
+
its users and sends the exported emails.
|
|
6
5
|
|
|
7
6
|
- `@weavour/editor`: JavaScript/TypeScript and classic script-tag integrations.
|
|
8
7
|
- `@weavour/react`: React component using the same core and hosted iframe.
|
|
@@ -33,9 +32,7 @@ editor.destroy();
|
|
|
33
32
|
|
|
34
33
|
Supply an element with an explicit height, for example 700px. The SDK appends a
|
|
35
34
|
full-width, full-height titled iframe and preserves other container children.
|
|
36
|
-
The default iframe is `https://weavour.com/editor`.
|
|
37
|
-
`editorUrl: 'http://localhost:8788/editor'` and
|
|
38
|
-
`apiUrl: 'http://localhost:8787'` explicitly.
|
|
35
|
+
The default iframe is `https://weavour.com/editor`.
|
|
39
36
|
|
|
40
37
|
## Script tags
|
|
41
38
|
|
|
@@ -75,6 +72,14 @@ to switch identity or initial documents, after preserving current work. Callback
|
|
|
75
72
|
changes do not recreate the iframe. Imports are SSR-safe; mounting runs on the
|
|
76
73
|
client. Next.js examples use a client component boundary.
|
|
77
74
|
|
|
75
|
+
## Email audit
|
|
76
|
+
|
|
77
|
+
Email-content quality checks are enabled by default. Set `enableEmailAudit: false`
|
|
78
|
+
at mount, in `editorConfig`, or through `editor.updateConfig(...)` to turn them
|
|
79
|
+
off. The React wrapper also accepts `enableEmailAudit` as a live prop. A saved
|
|
80
|
+
dashboard disable takes precedence over SDK preferences. Toggling preserves the
|
|
81
|
+
email and undo history. This requires the matching hosted iframe support.
|
|
82
|
+
|
|
78
83
|
## Identity and permissions
|
|
79
84
|
|
|
80
85
|
`editorKey` is public. `userId` and optional `organizationId` are declarative
|
|
@@ -104,11 +109,3 @@ npm run verify
|
|
|
104
109
|
npx playwright install chromium firefox webkit
|
|
105
110
|
npm run test:browser
|
|
106
111
|
```
|
|
107
|
-
|
|
108
|
-
GitHub Actions runs package checks and tests on **every push and pull request**,
|
|
109
|
-
using Node 22/24 and React 18/19, plus Chromium, Firefox and WebKit browser checks.
|
|
110
|
-
Browser tests use a small mock iframe, not a copy of the hosted editor. Real
|
|
111
|
-
hosted integrations require a configured public editor key and allowed origin.
|
|
112
|
-
|
|
113
|
-
See [release instructions](docs/releases.md) for npm trusted publishing and
|
|
114
|
-
private hosted-editor promotion. Installing this SDK does not self-host the editor.
|
package/dist/editor.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Weavour embedding SDK v0.1.
|
|
1
|
+
/*! Weavour embedding SDK v0.1.2 | MIT | https://github.com/weavour/editor-sdk */
|
|
2
2
|
"use strict";
|
|
3
3
|
(() => {
|
|
4
4
|
// packages/editor/src/merge-tags.ts
|
|
@@ -153,6 +153,9 @@
|
|
|
153
153
|
for (const value of [options.enableTemplates, options.editorConfig?.enableTemplates]) {
|
|
154
154
|
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableTemplates must be a boolean.");
|
|
155
155
|
}
|
|
156
|
+
for (const value of [options.enableEmailAudit, options.editorConfig?.enableEmailAudit]) {
|
|
157
|
+
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
158
|
+
}
|
|
156
159
|
for (const [name, limit] of [["subject", 200], ["preheader", 500]]) {
|
|
157
160
|
if (options[name] !== void 0 && (typeof options[name] !== "string" || options[name].length > limit)) throw new TypeError(name + " must be a string within its length limit.");
|
|
158
161
|
}
|
|
@@ -183,6 +186,7 @@
|
|
|
183
186
|
editorKey: options.editorKey,
|
|
184
187
|
draftId: options.draftId,
|
|
185
188
|
enableAutosave: options.enableAutosave ?? options.editorConfig?.enableAutosave,
|
|
189
|
+
enableEmailAudit: options.enableEmailAudit ?? options.editorConfig?.enableEmailAudit,
|
|
186
190
|
userId: options.userId,
|
|
187
191
|
organizationId: options.organizationId,
|
|
188
192
|
locale: options.locale || "en",
|
|
@@ -408,7 +412,7 @@
|
|
|
408
412
|
ready = true;
|
|
409
413
|
iframe.style.visibility = "visible";
|
|
410
414
|
clearTimeout(timer);
|
|
411
|
-
if (config.allowedBlocks !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks } }, origin);
|
|
415
|
+
if (config.allowedBlocks !== void 0 || config.enableEmailAudit !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks, enableEmailAudit: config.enableEmailAudit } }, origin);
|
|
412
416
|
resolveReady();
|
|
413
417
|
if (typeof options.onReady === "function") options.onReady();
|
|
414
418
|
}
|
|
@@ -593,6 +597,8 @@
|
|
|
593
597
|
}
|
|
594
598
|
}
|
|
595
599
|
}
|
|
600
|
+
if (next.enableEmailAudit !== void 0 && typeof next.enableEmailAudit !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
601
|
+
if (next.enableEmailAudit !== void 0) config.enableEmailAudit = next.enableEmailAudit;
|
|
596
602
|
if (next.enableAi !== void 0 && typeof next.enableAi !== "boolean") throw new TypeError("enableAi must be a boolean.");
|
|
597
603
|
if (next.enableAi !== void 0) config.enableAi = next.enableAi;
|
|
598
604
|
if (Object.hasOwn(next, "aiPaidOrigin")) {
|
|
@@ -612,7 +618,7 @@
|
|
|
612
618
|
config.theme = { ...config.theme, ...structuredClone(next.theme) };
|
|
613
619
|
}
|
|
614
620
|
if (next.locale) config.locale = next.locale;
|
|
615
|
-
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, allowedBlocks: config.allowedBlocks } }, origin);
|
|
621
|
+
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, enableEmailAudit: config.enableEmailAudit, allowedBlocks: config.allowedBlocks } }, origin);
|
|
616
622
|
}
|
|
617
623
|
function exportHTML(previewOnly = false) {
|
|
618
624
|
if (demo) return Promise.reject(new EditorError("demo_restricted", "Export is disabled in demo mode."));
|
package/dist/index.js
CHANGED
|
@@ -150,6 +150,9 @@ function createSDK(settings = {}) {
|
|
|
150
150
|
for (const value of [options.enableTemplates, options.editorConfig?.enableTemplates]) {
|
|
151
151
|
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableTemplates must be a boolean.");
|
|
152
152
|
}
|
|
153
|
+
for (const value of [options.enableEmailAudit, options.editorConfig?.enableEmailAudit]) {
|
|
154
|
+
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
155
|
+
}
|
|
153
156
|
for (const [name, limit] of [["subject", 200], ["preheader", 500]]) {
|
|
154
157
|
if (options[name] !== void 0 && (typeof options[name] !== "string" || options[name].length > limit)) throw new TypeError(name + " must be a string within its length limit.");
|
|
155
158
|
}
|
|
@@ -180,6 +183,7 @@ function createSDK(settings = {}) {
|
|
|
180
183
|
editorKey: options.editorKey,
|
|
181
184
|
draftId: options.draftId,
|
|
182
185
|
enableAutosave: options.enableAutosave ?? options.editorConfig?.enableAutosave,
|
|
186
|
+
enableEmailAudit: options.enableEmailAudit ?? options.editorConfig?.enableEmailAudit,
|
|
183
187
|
userId: options.userId,
|
|
184
188
|
organizationId: options.organizationId,
|
|
185
189
|
locale: options.locale || "en",
|
|
@@ -405,7 +409,7 @@ function createSDK(settings = {}) {
|
|
|
405
409
|
ready = true;
|
|
406
410
|
iframe.style.visibility = "visible";
|
|
407
411
|
clearTimeout(timer);
|
|
408
|
-
if (config.allowedBlocks !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks } }, origin);
|
|
412
|
+
if (config.allowedBlocks !== void 0 || config.enableEmailAudit !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks, enableEmailAudit: config.enableEmailAudit } }, origin);
|
|
409
413
|
resolveReady();
|
|
410
414
|
if (typeof options.onReady === "function") options.onReady();
|
|
411
415
|
}
|
|
@@ -590,6 +594,8 @@ function createSDK(settings = {}) {
|
|
|
590
594
|
}
|
|
591
595
|
}
|
|
592
596
|
}
|
|
597
|
+
if (next.enableEmailAudit !== void 0 && typeof next.enableEmailAudit !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
598
|
+
if (next.enableEmailAudit !== void 0) config.enableEmailAudit = next.enableEmailAudit;
|
|
593
599
|
if (next.enableAi !== void 0 && typeof next.enableAi !== "boolean") throw new TypeError("enableAi must be a boolean.");
|
|
594
600
|
if (next.enableAi !== void 0) config.enableAi = next.enableAi;
|
|
595
601
|
if (Object.hasOwn(next, "aiPaidOrigin")) {
|
|
@@ -609,7 +615,7 @@ function createSDK(settings = {}) {
|
|
|
609
615
|
config.theme = { ...config.theme, ...structuredClone(next.theme) };
|
|
610
616
|
}
|
|
611
617
|
if (next.locale) config.locale = next.locale;
|
|
612
|
-
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, allowedBlocks: config.allowedBlocks } }, origin);
|
|
618
|
+
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, enableEmailAudit: config.enableEmailAudit, allowedBlocks: config.allowedBlocks } }, origin);
|
|
613
619
|
}
|
|
614
620
|
function exportHTML(previewOnly = false) {
|
|
615
621
|
if (demo) return Promise.reject(new EditorError("demo_restricted", "Export is disabled in demo mode."));
|
package/dist/legacy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! Weavour embedding SDK v0.1.
|
|
1
|
+
/*! Weavour embedding SDK v0.1.2 | MIT | https://github.com/weavour/editor-sdk */
|
|
2
2
|
"use strict";
|
|
3
3
|
(() => {
|
|
4
4
|
// packages/editor/src/merge-tags.ts
|
|
@@ -153,6 +153,9 @@
|
|
|
153
153
|
for (const value of [options.enableTemplates, options.editorConfig?.enableTemplates]) {
|
|
154
154
|
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableTemplates must be a boolean.");
|
|
155
155
|
}
|
|
156
|
+
for (const value of [options.enableEmailAudit, options.editorConfig?.enableEmailAudit]) {
|
|
157
|
+
if (value !== void 0 && typeof value !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
158
|
+
}
|
|
156
159
|
for (const [name, limit] of [["subject", 200], ["preheader", 500]]) {
|
|
157
160
|
if (options[name] !== void 0 && (typeof options[name] !== "string" || options[name].length > limit)) throw new TypeError(name + " must be a string within its length limit.");
|
|
158
161
|
}
|
|
@@ -183,6 +186,7 @@
|
|
|
183
186
|
editorKey: options.editorKey,
|
|
184
187
|
draftId: options.draftId,
|
|
185
188
|
enableAutosave: options.enableAutosave ?? options.editorConfig?.enableAutosave,
|
|
189
|
+
enableEmailAudit: options.enableEmailAudit ?? options.editorConfig?.enableEmailAudit,
|
|
186
190
|
userId: options.userId,
|
|
187
191
|
organizationId: options.organizationId,
|
|
188
192
|
locale: options.locale || "en",
|
|
@@ -408,7 +412,7 @@
|
|
|
408
412
|
ready = true;
|
|
409
413
|
iframe.style.visibility = "visible";
|
|
410
414
|
clearTimeout(timer);
|
|
411
|
-
if (config.allowedBlocks !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks } }, origin);
|
|
415
|
+
if (config.allowedBlocks !== void 0 || config.enableEmailAudit !== void 0) post({ type: "weavour:update-config", version: 1, config: { allowedBlocks: config.allowedBlocks, enableEmailAudit: config.enableEmailAudit } }, origin);
|
|
412
416
|
resolveReady();
|
|
413
417
|
if (typeof options.onReady === "function") options.onReady();
|
|
414
418
|
}
|
|
@@ -593,6 +597,8 @@
|
|
|
593
597
|
}
|
|
594
598
|
}
|
|
595
599
|
}
|
|
600
|
+
if (next.enableEmailAudit !== void 0 && typeof next.enableEmailAudit !== "boolean") throw new TypeError("enableEmailAudit must be a boolean.");
|
|
601
|
+
if (next.enableEmailAudit !== void 0) config.enableEmailAudit = next.enableEmailAudit;
|
|
596
602
|
if (next.enableAi !== void 0 && typeof next.enableAi !== "boolean") throw new TypeError("enableAi must be a boolean.");
|
|
597
603
|
if (next.enableAi !== void 0) config.enableAi = next.enableAi;
|
|
598
604
|
if (Object.hasOwn(next, "aiPaidOrigin")) {
|
|
@@ -612,7 +618,7 @@
|
|
|
612
618
|
config.theme = { ...config.theme, ...structuredClone(next.theme) };
|
|
613
619
|
}
|
|
614
620
|
if (next.locale) config.locale = next.locale;
|
|
615
|
-
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, allowedBlocks: config.allowedBlocks } }, origin);
|
|
621
|
+
if (ready) post({ type: "weavour:update-config", version: 1, config: { mergeTags: config.mergeTags, theme: config.theme, locale: config.locale, enableAi: config.enableAi, enableTemplates: config.enableTemplates, enableAutosave: config.enableAutosave, enableEmailAudit: config.enableEmailAudit, allowedBlocks: config.allowedBlocks } }, origin);
|
|
616
622
|
}
|
|
617
623
|
function exportHTML(previewOnly = false) {
|
|
618
624
|
if (demo) return Promise.reject(new EditorError("demo_restricted", "Export is disabled in demo mode."));
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED