@weavour/editor 0.1.1 → 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 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. The SDKs are MIT licensed; the hosted
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.
@@ -73,6 +72,14 @@ to switch identity or initial documents, after preserving current work. Callback
73
72
  changes do not recreate the iframe. Imports are SSR-safe; mounting runs on the
74
73
  client. Next.js examples use a client component boundary.
75
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
+
76
83
  ## Identity and permissions
77
84
 
78
85
  `editorKey` is public. `userId` and optional `organizationId` are declarative
@@ -102,4 +109,3 @@ npm run verify
102
109
  npx playwright install chromium firefox webkit
103
110
  npm run test:browser
104
111
  ```
105
-
package/dist/editor.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! Weavour embedding SDK v0.1.1 | MIT | https://github.com/weavour/editor-sdk */
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 | MIT | https://github.com/weavour/editor-sdk */
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
@@ -51,6 +51,7 @@ export type EditorConfig = {
51
51
  aiPaidOrigin?: string;
52
52
  enableTemplates?: boolean;
53
53
  enableAutosave?: boolean;
54
+ enableEmailAudit?: boolean;
54
55
  };
55
56
  export type EditorCallbacks = {
56
57
  onReady?(): void;
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.1",
2
+ "version": "0.1.2",
3
3
  "type": "module",
4
4
  "license": "MIT",
5
5
  "repository": {