hivewrite-sdk 1.1.9 → 1.1.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
@@ -15,7 +15,8 @@ A powerful, flexible, and easy-to-integrate drag-and-drop email builder for Reac
15
15
  - 🎯 **Merge Tags** - Dynamic content placeholders for personalization
16
16
  - 🖼️ **Stock Images** - Built-in Unsplash integration for stock photos
17
17
  - 🏗️ **Pre-built Templates** - E-commerce, marketing, and transactional email templates
18
- - 🔧 **Fully Customizable** - White-labeling, permissions, and branding options
18
+ - **Saved Sections** - Save and reuse custom block groups across templates
19
+ - �🔧 **Fully Customizable** - White-labeling, permissions, and branding options
19
20
 
20
21
  ---
21
22
 
@@ -54,7 +55,6 @@ const MyEditor = () => {
54
55
  locale: 'en',
55
56
  callbacks: {
56
57
  onLoad: () => console.log('Editor ready'),
57
- onSave: (design) => console.log('Saved:', design),
58
58
  onExport: (html) => console.log('HTML:', html)
59
59
  }
60
60
  });
@@ -80,7 +80,6 @@ const MyEditor = () => {
80
80
  locale: 'en',
81
81
  callbacks: {
82
82
  onLoad: () => console.log('Editor ready'),
83
- onSave: (design) => console.log('Saved:', design),
84
83
  onExport: (html) => console.log('HTML:', html)
85
84
  }
86
85
  });
@@ -106,8 +105,9 @@ Initializes and mounts the editor.
106
105
  | `theme` | `string` | No | `'light'` (default) or `'dark'` |
107
106
  | `locale` | `string` | No | `'en'` (default), `'es'`, or `'fr'` |
108
107
  | `branding` | `object` | No | Custom white-labeling options |
109
- | `permissions` | `object` | No | Toggle features: `exportHTML`, `aiMagic`, `uploadImages` |
108
+ | `permissions` | `object` | No | Toggle features: `export`, `aiMagic`, `uploadImages` |
110
109
  | `mergeTags` | `array` | No | Array of `{ label, value }` for dynamic content |
110
+ | `portalTarget` | `string` | No | `'window'` (default) or `'container'`. Controls where dialogs render. |
111
111
  | `callbacks` | `object` | No | Event hooks for SDK actions |
112
112
 
113
113
  ---
@@ -192,7 +192,7 @@ Control what features are available:
192
192
 
193
193
  ```javascript
194
194
  permissions: {
195
- exportHTML: true, // Allow HTML export
195
+ export: true, // Allow HTML export
196
196
  aiMagic: true, // Enable AI features
197
197
  uploadImages: false // Disable uploads (stock images only)
198
198
  }
@@ -219,8 +219,7 @@ mergeTags: [
219
219
  | Callback | Arguments | Description |
220
220
  | :--- | :--- | :--- |
221
221
  | `onLoad` | `()` | Editor fully initialized |
222
- | `onSave` | `(json: any, userId?: string)` | User saves or `saveDesign` called |
223
- | `onExport` | `(html: string, userId?: string)` | User exports or `exportHtml` called |
222
+ | `onExport` | `(html: string, userId?: string)` | User exports or `export` called |
224
223
  | `onError` | `(err: any, userId?: string)` | Initialization or processing error |
225
224
  | `onTemplateChange` | `(templateId: string, userId?: string)` | Template selection changed |
226
225
  | `onImageUpload` | `(file: File, userId?: string)` | **Async**. Handle image uploads, return URL |
@@ -241,10 +240,14 @@ callbacks: {
241
240
 
242
241
  ### Response Examples
243
242
 
244
- #### `onSave(design, userId)`
245
- The `design` object contains the full state of the editor.
243
+ #### `hivewrite.save()`
244
+ Returns the current design state as a JSON object.
246
245
 
247
246
  ```javascript
247
+ const design = hivewrite.save();
248
+ console.log(design);
249
+
250
+ // Output:
248
251
  {
249
252
  "blocks": [ ... ], // Array of block objects
250
253
  "canvasSettings": { ... }, // Canvas styles (width, background, etc)
@@ -297,7 +300,7 @@ Exported HTML is fully compatible with:
297
300
  | :--- | :--- |
298
301
  | `init(config)` | Initialize the editor |
299
302
  | `export({ format, minify?, inlineCSS? })` | Export design to HTML or JSON |
300
- | `saveTemplate({ name })` | Save as reusable template |
303
+ | `save()` | Save current design state to JSON |
301
304
  | `importHTML({ html })` | Import HTML into editor (experimental) |
302
305
  | `setTheme(theme)` | Switch theme at runtime |
303
306
  | `setUserId(userId)` | Update user ID at runtime |