useblocks 1.1.72 → 1.1.81

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.
Files changed (61) hide show
  1. package/CHANGELOG.md +426 -0
  2. package/README.md +38 -0
  3. package/iframe/js/amp.Da_6yDxX.js +1 -0
  4. package/iframe/js/iframe-eblock.js +1 -1
  5. package/iframe/js/iframe.js +1 -1
  6. package/iframe/js/rules.4N5s3OV-.js +1 -1
  7. package/package.json +30 -9
  8. package/static/core/1ab52017.js +2134 -0
  9. package/static/core/4296ff4b.js +3280 -0
  10. package/static/core/{d082c64e2.js → 496a28e52.js} +2682 -2421
  11. package/static/core/{efbe495c.js → 5cc21a00.js} +2410 -2560
  12. package/static/core/{b7c107e3.js → 6a3ea43c.js} +15 -15
  13. package/static/core/{e02024fb2.js → 6fc5508e2.js} +69 -69
  14. package/static/core/{bfab4558.js → 7cff1d56.js} +3443 -3118
  15. package/static/core/87de8255.js +1098 -0
  16. package/static/core/{dd94baa62.js → 909c874d2.js} +1195 -1122
  17. package/static/core/{ffc83e02.js → ace7c2d1.js} +7 -7
  18. package/static/core/{5e082e16.js → c287f8b6.js} +38 -38
  19. package/static/core/{585259872.js → cc4c61c42.js} +108 -108
  20. package/static/core/{d645302e.js → d2293148.js} +272 -248
  21. package/static/core/{d19e8c6f.js → d70b5c31.js} +22333 -19548
  22. package/static/core/{842c8d41.js → dfbad00e.js} +4 -4
  23. package/static/core/{ce9be2ec2.js → f2b0c97b2.js} +2138 -2086
  24. package/static/core/{24c3f399.js → f7e3905a.js} +3 -3
  25. package/static/core/{513594a8.js → fc514220.js} +34 -34
  26. package/static/umd-runtime/ui-kit.js +1171 -1103
  27. package/ui-kit/index.js +1541 -1469
  28. package/{useblocks-core.8837a348.js → useblocks-core.0a682f7d.js} +6 -6
  29. package/useblocks-esm.js +4 -4
  30. package/{useblocks-po.8837a348.js → useblocks-po.0a682f7d.js} +1 -1
  31. package/useblocks.d.ts +4 -0
  32. package/useblocks.js +3 -3
  33. package/favicon-b.ico +0 -0
  34. package/favicon.ico +0 -0
  35. package/fonts/SegoeUI-Bold.woff2 +0 -0
  36. package/fonts/SegoeUI-Semibold.woff2 +0 -0
  37. package/fonts/SegoeUI.woff2 +0 -0
  38. package/iframe/js/amp.DllX-Im0.js +0 -1
  39. package/js/amplitude.min.js +0 -10859
  40. package/js/sourcebuster.min.js +0 -672
  41. package/manifest.json +0 -17
  42. package/npm-publish.manifest.json +0 -51
  43. package/static/core/241f0387.js +0 -3189
  44. package/static/core/45b5e246.js +0 -925
  45. package/static/core/9bcb736c.js +0 -2122
  46. package/static/media/image-editor/images/samples/large_sample.jpg +0 -0
  47. package/static/media/image-editor/images/samples/sample1.jpg +0 -0
  48. package/static/media/image-editor/images/samples/sample1_thumbnail.jpg +0 -0
  49. package/static/media/image-editor/images/samples/sample2.jpg +0 -0
  50. package/static/media/image-editor/images/samples/sample2_thumbnail.jpg +0 -0
  51. package/static/media/image-editor/images/samples/sample3.jpg +0 -0
  52. package/static/media/image-editor/images/samples/sample3_thumbnail.jpg +0 -0
  53. package/static/media/image-editor/images/samples/sample4.json +0 -871
  54. package/static/media/image-editor/images/samples/sample4_preview.jpg +0 -0
  55. package/test-font.otf +0 -0
  56. package/test-font.ttf +0 -0
  57. package/test-font.woff2 +0 -0
  58. package/tsconfig.json +0 -14
  59. package/two_step_headless_plugin.html +0 -558
  60. /package/iframe/{iframe-eblock.8837a348.html → iframe-eblock.0a682f7d.html} +0 -0
  61. /package/iframe/{iframe.8837a348.html → iframe.0a682f7d.html} +0 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,426 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
6
+
7
+ ---
8
+
9
+ ## [1.1.81] - 2026-09-17
10
+
11
+ ### Added
12
+
13
+ - Project styles in the plugin: `projectStyles` section in `init(options)` with the brand palette,
14
+ custom fonts and social links. Colors show up in the color pickers, fonts in the font picker and on
15
+ the canvas, and the "Social" element is filled with the project's links instead of a placeholder
16
+ - Email export to Markdown: a sub-item of the text export menu, `exportMarkdownEnabled` option
17
+ - Gmail annotations for the Promotions tab: a separate sidebar tab with a card preview,
18
+ `annotationsEnabled` option (off by default)
19
+ - "Swap columns" button for float block columns
20
+ - Plan limits apply to every editor feature: unavailable ones are either locked with an upgrade
21
+ offer or hidden; locks are lifted right after payment, without a reload
22
+
23
+ ### Fixed
24
+
25
+ - Showing and saving an email in the plugin: switching to another email or showing a template no
26
+ longer recreates the editor; subject and preheader edited in the UI are no longer rolled back;
27
+ unsaved autosaved edits are no longer overwritten by the server version; a new email without
28
+ markup opens with a starter layout, and the canvas is no longer reset after the first save;
29
+ `save()` with no email shown fails right away
30
+ - Plugin: if `handleLoadImage` throws, the editor shows the error message instead of uploading the
31
+ image to the UseBlocks backend; project styles are no longer requested from the UseBlocks backend
32
+ - Styles of a saved block no longer stretch the editor UI; block previews get the right height once
33
+ images load
34
+ - Editor: a variable in an image address is kept on save; content text color can be changed after
35
+ white; the button wrapper cell no longer shows up in breadcrumbs; a disabled border no longer comes
36
+ back with old values; removing the last block no longer leaves an empty table
37
+ - BeeFree layout converter: spacing of text, buttons, social icons and dividers is taken from the
38
+ source, loose text is no longer lost, Google fonts are attached
39
+ - File Manager: readable names for stock images and GIFs instead of `photo-<id>` and
40
+ `giphy-downsized`; GIF previews show up immediately; a version in the link query is no longer taken
41
+ for the file extension; no more i18next promo message in the console
42
+ - Error notifications show the server response, such as "Limit exceeded", instead of `rejected`
43
+ - Translations: project member dialogs, the block counter in bulk save, layout converter strings
44
+
45
+ ### Changed
46
+
47
+ - npm package contents are now an allowlist: the plugin test page, test fonts, analytics scripts and
48
+ the PWA manifest are no longer shipped; `CHANGELOG.md` is now included
49
+
50
+ ---
51
+
52
+ ## [1.1.71] - 2026-09-03
53
+
54
+ ### Added
55
+
56
+ - Project settings page: a single page with tabs — description and logo, storage, brand styles,
57
+ members and roles, integrations, plugin. The editor picks up the project's brand fonts and colors,
58
+ and unsaved edits are no longer lost when leaving the page
59
+ - The project card in the list shows the description and logo; the members table gained role,
60
+ invitation date, join date and last login
61
+ - Algorithmic Stripo layout converter: `stripoConverterEnabled` option. Runs locally and instantly,
62
+ without the AI service. Fixed-width emails convert to the non-responsive form, adaptive ones keep
63
+ their mobile rules
64
+ - Support chat is available to everyone: it is embedded directly, without Google Tag Manager, and
65
+ recognizes the signed-in user
66
+ - Email preview mode that hides the service markers of hidden blocks
67
+ - API error texts translated into Russian, Ukrainian, Spanish and Portuguese; the response language
68
+ is picked from the user profile and the `Accept-Language` header
69
+
70
+ ### Fixed
71
+
72
+ - Showing and saving an email in the plugin: a repeated `show()` of the same email no longer
73
+ recreates the canvas, switching to another email no longer waits for a timeout, the first save no
74
+ longer reloads the editor, and the second one goes with the assigned id instead of creating a
75
+ copy; no requests are sent after `destroy`
76
+ - Subject and preheader taken from the markup are no longer lost on save, and the save response no
77
+ longer rolls back fresh email metadata
78
+ - A new email created from a template keeps the link to its parent; history is requested for the
79
+ email actually shown
80
+ - Export: an email could be lost because of markup after `</html>`; an HTML build failure is no
81
+ longer reported as an empty result
82
+ - Layout converter: blocks are no longer lost in a hand-edited BeeFree email; a button without its
83
+ own width is no longer forced to 200px
84
+ - Social blocks are told apart in the settings pane by their position in the document
85
+ - Links in an email are no longer wrapped in a `span` with an underline
86
+ - File Manager: the file name is no longer lost in a CDN link with a query; settings now reach the
87
+ standalone image editor
88
+ - Translations: the "Project" menu, the unsaved changes dialog, integration descriptions and
89
+ statuses
90
+ - A catalog for a different locale is no longer applied, and an empty response no longer wipes the
91
+ translation cache
92
+ - Navigation in the SaaS version
93
+
94
+ ---
95
+
96
+ ## [1.1.60] - 2026-08-14
97
+
98
+ ### Added
99
+
100
+ - PNG export of an email as an archive containing desktop and mobile renders
101
+ - Trial period: an in-editor dialog offering the paid plan trial and a unified activation dialog on
102
+ the pricing page
103
+ - Project-owner plan gating: autosave and paid dialogs respect the project owner's plan instead of
104
+ the current user's; the owner's plan is part of the project domain model
105
+ - File Manager: lockable library tabs with a badge
106
+
107
+ ### Fixed
108
+
109
+ - Plugin resilience to backend outages: deferred standalone mode, failover no longer aborts on
110
+ authorization errors and switches back to the primary origin after recovery
111
+ - Editor performance: fewer redundant re-renders of the email pane and settings forms, smooth
112
+ drag-and-drop
113
+ - Public email preview no longer redirects to the login page
114
+ - A headless container without an explicit size broke the email layout and shrank images
115
+ - File Manager: preview shows the file while its thumbnail is not ready yet; image compression is
116
+ disabled when compression limits are zero; removed folder duplication in the tree
117
+
118
+ ---
119
+
120
+ ## [1.1.47] - 2026-08-07
121
+
122
+ ### Added
123
+
124
+ - Host-supplied AI in place of the built-in one: `handleAITextRequest` (chat assistant and email
125
+ generator) and `handleAIImageRequest` (image generation) callbacks in `init(options)`. The host
126
+ receives progress via `onProgress`, partial HTML via `onStreamChunk` and an `AbortSignal` for
127
+ cancellation; such generations are not gated by UseBlocks limits and are not counted against the
128
+ subscription quota.
129
+ - Public `templateDirectives` contract: an escaping policy for ESP template directives, applied
130
+ consistently in the editor, the block editor and on export (HTML, EML, ZIP)
131
+ - App tokens for integrators: `POST /auth/app/token`; the layout converter now works with app
132
+ tokens with per-client limits
133
+ - Headless embedding mode for the editor
134
+ - Password change in the user profile
135
+ - File Manager: parallel compression of uploaded files
136
+
137
+ ### Fixed
138
+
139
+ - Browser auto-translation is disabled — it was breaking the editor
140
+ - Monaco: ESM workers with a cross-origin publicPath
141
+ - Cyrillic file names are decoded on upload by URL
142
+ - Stable embedding in Angular and Module Federation hosts
143
+
144
+ ### Changed
145
+
146
+ - Migration to React 19 (Redux Toolkit 2, custom IframeResizer)
147
+ - Google, Yandex and eLama sign-in, registration and CAPTCHA moved to the new Go backend
148
+ (`/api/v2/auth/*`)
149
+ - The projects page is moving to the Go backend `/api/v2` (behind a flag): members and invitations,
150
+ single-save settings, tags and folders, ESP integrations, storage settings
151
+ - File Manager: a Go-backend provider (behind a flag) — background indexing of the legacy file tree
152
+ with a progress indicator, automatic thumbnail loading, trash with restore into a chosen folder
153
+
154
+ ---
155
+
156
+ ## [1.1.29] - 2026-07-14
157
+
158
+ ### Added
159
+
160
+ - Layout converter for foreign markup to UseBlocks format: separate flags `beeFreeConverterEnabled` (deterministic BeeFree/Stripo conversion) and `aiLayoutConverterEnabled` (AI conversion of other markup)
161
+ - CAPTCHA on login and sign-up forms (Cloudflare Turnstile, Yandex SmartCaptcha)
162
+ - UTM tags and dynamic URL substitutions on export
163
+ - VML button improvements for Outlook compatibility
164
+
165
+ ### Fixed
166
+
167
+ - Content sync between iframe and Monaco (echo loop, autosave)
168
+ - Stable editor embed in external React/Microfrontend hosts (StrictMode, publicPath)
169
+ - Readable error toasts; autosave no longer blocks user edits
170
+ - White screen when the locale API is unavailable
171
+
172
+ ### Changed
173
+
174
+ - UI Kit and app UI migrated to Ant Design 6
175
+ - File Manager updated to 1.1.0
176
+
177
+ ---
178
+
179
+ ## [1.1.25] - 2026-07-07
180
+
181
+ ### Added
182
+
183
+ - Float block copy
184
+ - Global blocks: available to all users, synchronization reworked
185
+ - Code mode in the editor sidebar
186
+ - Empty states in the emails and projects tables
187
+ - Save and autosave loading indicators
188
+
189
+ ### Fixed
190
+
191
+ - Email subject and preheader
192
+ - Autosave recovery after failure
193
+ - Accidental removal of all styles in a block
194
+ - HTML sanitization against AdGuard and other browser extensions
195
+ - Vite host plugin: public path in dev mode
196
+
197
+ ---
198
+
199
+ ## [1.1.4] - 2026-06-15
200
+
201
+ ### Added
202
+
203
+ - Analytics for actions in the email editor iframe
204
+ - Improved drag-and-drop atom insertion into the email
205
+
206
+ ### Fixed
207
+
208
+ - Image and video preview in element settings (`SelectedImageForm`)
209
+ - Meta and layout synchronization in the social block form (`SelectedSocialForm`)
210
+ - Detection and sanitization of styles broken by browser extensions (adblock)
211
+ - Settings panel tab navigation (`PanelFormTabsOverrides`)
212
+
213
+ ### Changed
214
+
215
+ - Sentry: switched to a reinstalled self-hosted instance
216
+
217
+ ---
218
+
219
+ ## [1.1.0] - 2026-06-08
220
+
221
+ ### Added
222
+
223
+ - Plugin system: extensions API, sandbox API, plugin development CLI, internal plugins; email settings API for plugins (DEV-11837)
224
+ - Global blocks: creation, preview markers, sync changes across all templates
225
+ - Projects page (DEV-11990): card view, search and filters, Viewer role, member management from menu and list, frequent projects in the sidebar
226
+ - Light/dark theme switching in the email editor
227
+ - Autosave with retry mechanism; correct `projectId` handling for new emails (DEV-14828)
228
+ - Roll back an email to a previous version (DEV-15046)
229
+ - UI Kit component localization
230
+ - Element settings change analytics in the panel (Amplitude `change_element_setting`)
231
+ - Link normalization in href fields
232
+ - EML export: embed images as base64
233
+
234
+ ### Fixed
235
+
236
+ - Rich text editor: formatting and text editing (DEV-14640, DEV-14852)
237
+ - Email variable editing (DEV-14582)
238
+ - Dark theme in the project menu and inbox card (DEV-14842)
239
+ - Stickers in the Pixie image editor (DEV-14969)
240
+ - Monaco: workers across different origins; ESM editor build
241
+ - Mobile text and button alignment
242
+ - Image preview URLs moved to env variables (DEV-15052)
243
+
244
+ ### Changed
245
+
246
+ - Build migrated to Vite/ESM; pnpm monorepo
247
+ - Prod releases and npm package version driven by git tags (`useblocks-v*`)
248
+ - Email HTML sanitization against browser extension interference
249
+
250
+ ---
251
+
252
+ ## [1.0.117] - 2026-04-07
253
+
254
+ ### Added
255
+
256
+ - Bulleted lists in the rich text editor (DEV-12615)
257
+ - Anchor links
258
+ - Billing page and UX: limits (`limitsApi`), usage stats, paywall and limit upgrade modals (`LimitUpgradeModal`, including `image_generate` overage), left-menu tariff widget (`MenuTariffWidget`): trial, subscription, auto-renew (DEV-11223 and related work)
259
+ - Billing modals: plan checkout choice (`PlanCheckoutChoiceModal`), legal-entity invoice request with prefilled fields and hidden-field sync (`TariffInvoiceRequestModal`)
260
+ - Social blocks overhaul: drag-and-drop, settings tooltips, custom icons; VK platform (`vkv`); contrast and atom/cell backgrounds; delete control in the social form; CDN URL updates and icon URL generation (DEV-13666 and related fixes)
261
+ - Text formatting options in `SelectedTextCommonForm`
262
+ - `commonStyles` in iframe and deep merging of content styles; panel padding refinements
263
+ - Strip `width` and `max-width` from images in non-responsive emails (`stripImageWidthForNonResponsive`)
264
+ - Explicit content-column width checks in multi-column layouts and correct block width recalculation
265
+
266
+ ### Fixed
267
+
268
+ - Email subject: whitespace handling and `title` tag parsing (`getSubject`)
269
+ - Email layout width for columns with the `em-insert-ignore` class
270
+ - Integrations: Dotdigital, Klaviyo, ActiveCampaign; updated Brevo API key help URL
271
+ - File manager: duplicate folder notification (409), scrollable folder list in the Move submenu, DataSource and copy flow updates; null crash in FloatingBlocks; file upload handling
272
+ - Thumbnail normalization for the Pixie image editor and display formats via `normalizeImageFormatForDisplay` in image loaders
273
+ - Text background in the email (DEV-14472)
274
+ - Navigate to the button parent element (DEV-14443)
275
+ - Image center fails to open (DEV-14425)
276
+ - Social blocks: root-table selectors, form and `ColorPickerInput` styling, spacing in `EmailPane` and the social form
277
+ - Theme switching; halt errors with Sentry and Unisender; path computation in the Vite plugin
278
+ - Disabled TypeScript checking for HTML in the Monaco editor
279
+ - Buttons: unified `height` and `line-height` tied to theme variables in `Button.scss`
280
+
281
+ ### Changed
282
+
283
+ - Sentry, file manager, and other dependency version bumps
284
+ - Updated base URLs for social network icon CDNs
285
+ - Billing: streamlined/refactored `BillingPage`, banners and auto-pay buttons; webhook build switched to `buildLegacyWebhookRequest`; removed Streamline and Giphy proxies; custom proxy support (DEV-14043)
286
+ - Shared styles: font specificity (`PanelForm`, `common.scss`), payment button styling in `BillingBannerModal`
287
+ - `Ribbon` component and notifications; billing and UI localization updates
288
+ - CI: removed redundant Allure report job; `GIT_CLONE_PATH` for test VM jobs
289
+
290
+ ---
291
+
292
+ ## [1.0.109] - 2026-04-07
293
+
294
+ ### Added
295
+
296
+ - Bulleted lists in the rich text editor (DEV-12615)
297
+ - AI settings: skip dialog queries when the assistant is disabled; richer context for the AI prompt
298
+ - Subscription fields in logging methods (DEV-13876)
299
+ - Error boundary errors reported to analytics
300
+
301
+ ### Fixed
302
+
303
+ - Email subject: whitespace handling and `title` tag parsing (getSubject)
304
+ - File manager: duplicate folder notification (409), scrollable folder list in the Move submenu, DataSource and copy flow updates
305
+ - Link forms: default protocol and empty URL handling
306
+ - Sandbox: drag-and-drop and click layering (pointer-events)
307
+ - `applicationElementSettingsSet` registration and element path filtering
308
+ - Thumbnail normalization for the Pixie image editor
309
+
310
+ ### Changed
311
+
312
+ - Sentry and dependency version bumps
313
+
314
+ ---
315
+
316
+ ## [1.0.108] - 2026-03-26
317
+
318
+ ### Added
319
+
320
+ - ESP integrations: Mailchimp, Klaviyo, HubSpot, Salesforce Marketing Cloud, ActiveCampaign, Brevo, Campaign Monitor, Constant Contact, GetResponse, Bento, Dotdigital
321
+ - Integrations tab in the project edit modal
322
+ - Data layer events for email export
323
+ - `imageCenterLocalUploadEnabled` for local uploads in the image center
324
+
325
+ ### Fixed
326
+
327
+ - File manager: Redux removed from FM integration (DEV-14018, DEV-13858), proxy and front-end pagination, stray Edited folder on upload
328
+ - Editor and sandbox: contenteditable iframe, empty list insertion (DEV-13612), text editing (DEV-13608), delete-from-end in blocks (DEV-13558), mobile text properties (DEV-13679)
329
+ - Email button issues (DEV-13746); alignment icons use `currentColor` (DEV-13790)
330
+ - Duplicate notifications when sending a test email (DEV-10977)
331
+ - Sorting in the projects table (DEV-13759)
332
+ - Autosave: `revisionService` guard and `emailId` in revisionToApply
333
+
334
+ ### Changed
335
+
336
+ - Blocks / Emails / Projects / Members tables: layout, menus, drag-and-drop on block and email pages
337
+ - Webhook handling in the email buttons component
338
+ - Dotdigital and ActiveCampaign integration improvements (drafts)
339
+
340
+ ---
341
+
342
+ ## [1.0.104-alpha.1] - 2026-03-02
343
+
344
+ ### Added
345
+
346
+ **Integrations:**
347
+
348
+ - Unisender integration and settings management
349
+ - App-specific integration availability system
350
+
351
+ **Editor:**
352
+
353
+ - Free plan restrictions in ButtonsEmail component
354
+ - mailto link support (subject, body) — DEV-13102
355
+ - Mass blocks functionality
356
+ - Element sorting
357
+ - Insert link with correct color — DEV-13172
358
+
359
+ **AI & UX:**
360
+
361
+ - AI functionality in EmailPageHeader with payment verification
362
+ - Improved modal animations
363
+
364
+ **FileManager:**
365
+
366
+ - Support for custom names when copying files and folders
367
+ - Cache clearing
368
+
369
+ ### Fixed
370
+
371
+ **Table Editor:**
372
+
373
+ - Dropdown menu layout for Table element — DEV-13370
374
+ - Table editor functionality — DEV-13371
375
+
376
+ **Paste & Links:**
377
+
378
+ - Tag duplication when pasting text — DEV-13293
379
+ - Link duplication when pasting — DEV-13378
380
+
381
+ **Elements:**
382
+
383
+ - Adding Button element to email — DEV-13312
384
+ - Incorrect marker settings display — DEV-13313
385
+ - Line break restriction for notifications — DEV-13143
386
+
387
+ **Data & API:**
388
+
389
+ - Tag and group changes when sending email data — DEV-10189
390
+ - Recurring payment calculation with `is_only_first_period` — DEV-13377
391
+ - Notification on test email send error
392
+ - Localization in yandexLoginProxyPage
393
+ - JWT token expiration check and 401 response handling
394
+
395
+ ### Changed
396
+
397
+ **sandbox.js → TypeScript Refactoring:**
398
+
399
+ - Migration to modular structure with types and centralized state
400
+ - Modules for mouse, keyboard, and drag-and-drop event handling
401
+ - Element settings handlers (links, variables, padding)
402
+ - Modules for accordions, buttons, carousels, tables
403
+ - Utilities for text formatting, styles, and VML
404
+
405
+ **Integrations:**
406
+
407
+ - IntegrationSettings renamed to IntegrationSettingsData
408
+ - Unisender integration migrated to flexible structure
409
+
410
+ **UI:**
411
+
412
+ - Updated layout for BlocksTable and EmailsTable
413
+ - Improved checkbox styles in tables
414
+
415
+ ### Testing
416
+
417
+ - Integration tests for html2Dom, dom2Html, and export pipeline
418
+ - Functional tests for css namespace in dom2Html
419
+ - Functional tests for html2Dom
420
+ - Tests for createWrapper function
421
+
422
+ ---
423
+
424
+ ## [1.0.103] - 2026-02-05
425
+
426
+ _Changelog not documented_
package/README.md CHANGED
@@ -121,6 +121,44 @@ You can take **`EMAIL_CODE`** from <a href="https://cdn.useblocks.io/plugin/new-
121
121
 
122
122
  For debugging, the dev build may support a front-end token flow — configure an auth proxy in your app if you use that path.
123
123
 
124
+ ### React wrapper
125
+
126
+ The package ships a ready-made component. It creates its own container, calls **`init`** on mount
127
+ and **`destroy`** on unmount.
128
+
129
+ ```tsx
130
+ import Useblocks from 'useblocks/react';
131
+
132
+ const content = { subject: 'Email subject', html: 'EMAIL_CODE' };
133
+ const editorConfig = { theme: 'light' };
134
+ const editorStyle = { height: '100vh' };
135
+
136
+ export function Editor({ getAuthToken }) {
137
+ return (
138
+ <Useblocks
139
+ getAuthToken={getAuthToken}
140
+ content={content}
141
+ config={editorConfig}
142
+ style={editorStyle}
143
+ />
144
+ );
145
+ }
146
+ ```
147
+
148
+ The component takes the same options as **`init`**, plus `id`, `className`, `style` and `container`
149
+ (any other container attributes). Do not pass **`element`** — the component supplies its own `div`.
150
+ Keep `react` 16.8 or newer in your own dependencies; it is not bundled.
151
+
152
+ Two limitations worth knowing up front:
153
+
154
+ - Every props update triggers an editor **`reset`**. Keep objects and callbacks stable
155
+ (`useMemo` / `useCallback`), otherwise the editor is recreated on every parent render.
156
+ - Initialization errors are neither rethrown nor displayed. A failing **`init`** leaves an empty
157
+ container — call **`init`** directly to diagnose it.
158
+
159
+ When you need full control over the lifecycle, mount the editor by hand with **`init`** and
160
+ **`destroy`** instead.
161
+
124
162
  # Configuration
125
163
 
126
164
  Configuration is a nested object: editor chrome, initial email payload, and callback hooks.