useblocks 1.1.108 → 1.2.0

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 (51) hide show
  1. package/README.md +54 -0
  2. package/iframe/.vite/manifest.json +4 -4
  3. package/iframe/{iframe-eblock.facd6272.html → iframe-eblock.71aea198.html} +2 -2
  4. package/iframe/{iframe.facd6272.html → iframe.71aea198.html} +2 -2
  5. package/iframe/js/{elMarkupHelper.JLkggsgY.js → elMarkupHelper.D_gxM3uK.js} +79 -79
  6. package/iframe/js/{iframe-eblock.body.facd6272.js → iframe-eblock.body.71aea198.js} +1 -1
  7. package/iframe/js/iframe-eblock.js +2 -2
  8. package/iframe/js/{iframe.body.facd6272.js → iframe.body.71aea198.js} +1 -1
  9. package/iframe/js/iframe.js +2 -2
  10. package/package.json +1 -1
  11. package/runtime/react/index.js +1 -1
  12. package/static/core/{c6bde249.js → 12f773c1.js} +1 -1
  13. package/static/core/{feb1ffa4.js → 1516d48e.js} +1 -1
  14. package/static/core/{38ea9ef6.js → 1594df08.js} +1 -1
  15. package/static/core/{e86ffdcb.js → 1d170e32.js} +1 -1
  16. package/static/core/{83a7fff3.js → 1dc51b93.js} +1 -1
  17. package/static/core/{622a2220.js → 28d63741.js} +1 -1
  18. package/static/core/{c9cebb1a.js → 29e211b1.js} +1 -1
  19. package/static/core/{9b50835f.js → 3d3eb29f.js} +1 -1
  20. package/static/core/{da678146.js → 3f80e59d.js} +6 -6
  21. package/static/core/{4ec0aff8.js → 5278dff9.js} +1 -1
  22. package/static/core/{cc70a22f.js → 57fee71e.js} +3 -3
  23. package/static/core/{19e01848.js → 5b586fcb.js} +1 -1
  24. package/static/core/{f50ba1e0.js → 69789892.js} +1 -1
  25. package/static/core/{87e91b5e.js → 6bc1c806.js} +1 -1
  26. package/static/core/{e8a44736.js → 6dcb28a1.js} +1 -1
  27. package/static/core/{aa65675c.js → 6f7a2152.js} +1 -1
  28. package/static/core/{f89490a1.js → 91f77c2d.js} +1 -1
  29. package/static/core/{34804219.js → 9f4f4873.js} +1 -1
  30. package/static/core/{32813d7b.js → a34a72bf.js} +2 -2
  31. package/static/core/{4d698359.js → bfb25e63.js} +1 -1
  32. package/static/core/{23ecb0b0.js → c8fe849c.js} +1 -1
  33. package/static/core/{2865a0ae.js → cea06bde.js} +1 -1
  34. package/static/core/{a77f31cb.js → cf548c07.js} +1 -1
  35. package/static/core/{42ef449b.js → d6929171.js} +1 -1
  36. package/static/core/{d8e8d436.js → def48fbd.js} +1 -1
  37. package/static/core/e460bb13.js +1 -0
  38. package/static/core/{fe5390c8.js → f0c51560.js} +1 -1
  39. package/static/core/{8a452a94.js → f9749132.js} +1 -1
  40. package/static/esm/f97f84b4.js +1 -0
  41. package/static/umd-runtime/runtime.DxsFr3F4.js +1 -0
  42. package/useblocks-core.71aea198.js +859 -0
  43. package/useblocks-esm.js +11 -11
  44. package/{useblocks-po.facd6272.js → useblocks-po.71aea198.js} +1 -1
  45. package/useblocks.d.ts +220 -1
  46. package/useblocks.js +12 -12
  47. package/vendor/useblocks-ui-kit/package.json +1 -1
  48. package/static/core/ebcc0451.js +0 -1
  49. package/static/esm/1e463a71.js +0 -1
  50. package/static/umd-runtime/runtime.DeDiWiET.js +0 -1
  51. package/useblocks-core.facd6272.js +0 -859
package/README.md CHANGED
@@ -448,6 +448,7 @@ Editor UI tuning. Use **`instance.setConfig`**, **`instance.updateConfig`**, **`
448
448
  | nextButtonText | Text on secondary button. | '' |
449
449
  | saveButtonEnabled | Show primary button. | true |
450
450
  | saveButtonText | Text on primary button. | '' |
451
+ | saveHotkeyEnabled | Save by Ctrl+S / Cmd+S. `false` turns it off; the browser's "Save page" dialog still does not open. | true |
451
452
  | commandButtonsEnabled | Show primary and secondary buttons. | true |
452
453
  | | | |
453
454
  | sidePanelFloating | Floating side panel. | true |
@@ -645,6 +646,8 @@ See typings (**`ExportedApi.DataMixin.Events`**) — includes for example **`han
645
646
  | handleEmailAutosave | Autosave created (**`EmailRevision`** with **`autosave: true`**); store it as is |
646
647
  | handleEmailInit | The email is shown on the canvas. Fires at start and on every `show()` that changes what is shown: another email; an email without `id` (each such show is a new draft); the same email with any passed field different — code, subject, preheader, common styles — even when the canvas is not reloaded; `show({ reload: true })`. Does not fire when a `show()` with the same `id` passes exactly what is already shown (fields left out are not compared), nor on an internal canvas reload. If the email was edited in the editor, repeating `show()` with the earlier code refills it and fires the event. Do not build one-off actions ("save on first open") on it. |
647
648
  | handleReadBlocks | Project blocks |
649
+ | handleValidate | Errors of the code editor (**`CodeError[]`**), the ones it underlines. Fires after the editor checks its text: on every edit while there are errors, and once when they are gone; no event when there were none and still are none. Only after the code mode has been opened. To validate the email on demand use **`validateCode()`**. |
650
+ | handleImportValidate | Errors of an imported file's own markup (**`{ errors: CodeError[], fileName }`**), found before the browser parses it: the browser silently repairs broken markup, so the editor no longer sees the errors. The file is checked only while someone listens to this event. The import is neither delayed nor cancelled; for a clean file **`errors`** is empty. |
648
651
  | handleReadCommonBlocks | Shared / common blocks |
649
652
  | handleReadTemplateBlocks | Template blocks for current email |
650
653
  | handleSaveBlock | Save block (**`SaveEventPayload`**) |
@@ -665,6 +668,57 @@ See typings (**`ExportedApi.DataMixin.Events`**) — includes for example **`han
665
668
  | handleSuccess | Success toast hook |
666
669
  | handleTestEmailSend | Send test mail |
667
670
  | handleTestEmailModal | Test send modal opened |
671
+ | handleAnalyticsEvent | A user action in the editor, for your analytics; see below |
672
+
673
+ #### Analytics: `handleAnalyticsEvent`
674
+
675
+ The editor reports user actions for your analytics (Amplitude, GA and the like). An event is
676
+ **`{ name, properties }`**:
677
+
678
+ - **`name`** follows `editor_<object>_<action>`: `editor_email_saved`, `editor_layout_convert_succeeded`;
679
+ - **`properties`** hold only closed lists of values, numbers and flags. Events carry no ids, names, email
680
+ text or addresses. Linking an event to your email or user is up to you: add your own id when you pass
681
+ the event to your analytics.
682
+
683
+ The handler is not awaited: its result is ignored, and an exception in it does not affect the editor.
684
+ Events come regardless of **`pushToGTM`**. Frequent events — an element setting being edited, the canvas
685
+ width — come as one, after a pause.
686
+
687
+ ```javascript
688
+ emailmaker.init({
689
+ element: '#editor',
690
+ content: { email: { id: '1' } },
691
+ getAuthToken,
692
+ handleAnalyticsEvent: ({ name, properties }) => {
693
+ amplitude.track(name, { ...properties, letter_id: currentLetterId });
694
+ },
695
+ });
696
+ ```
697
+
698
+ Converting third-party layouts (BeeFree, Stripo and others):
699
+
700
+ | Event | When | Properties |
701
+ | --- | --- | --- |
702
+ | `editor_layout_convert_offered` | The conversion offer was shown | `source`, `trigger` |
703
+ | `editor_layout_convert_declined` | The offer was dismissed | `source`, `trigger`, `never_suggest` |
704
+ | `editor_layout_convert_started` | An attempt started | `source`, `method`, `trigger` |
705
+ | `editor_layout_convert_succeeded` | The result is in the editor | `source`, `method`, `trigger`, `duration_ms`, `fallback_to_ai` |
706
+ | `editor_layout_convert_failed` | The attempt failed | `source`, `method`, `trigger`, `duration_ms`, `error_code` |
707
+
708
+ `source` — `beefree` / `stripo` / `unknown`; `method` — `algorithm` / `ai`; `trigger` — `prompt` (the offer on
709
+ opening the email), `import`, `menu`, `retry`.
710
+
711
+ Other events:
712
+
713
+ | Area | Events |
714
+ | --- | --- |
715
+ | Email and block | `editor_email_saved`, `editor_block_saved`, `editor_back_clicked`, `editor_email_deleted`, `editor_email_delete_clicked`, `editor_email_delete_modal_opened`, `editor_email_duplicate_clicked`, `editor_email_duplicated`, `editor_email_import_clicked`, `editor_email_imported`, `editor_email_exported`, `editor_email_locked`, `editor_email_unlocked`, `editor_block_locked`, `editor_block_unlocked` |
716
+ | Canvas and panels | `editor_element_added`, `editor_element_setting_changed`, `editor_canvas_resized`, `editor_pane_tab_opened`, `editor_config_mode_changed`, `editor_mode_changed`, `editor_code_mode_activated`, `editor_breadcrumb_clicked` |
717
+ | Checks and preview | `editor_code_checked`, `editor_links_checked`, `editor_images_checked`, `editor_spam_checked`, `editor_preview_opened`, `editor_test_email_modal_opened`, `editor_test_email_sent`, `editor_email_shared`, `editor_inbox_tests_opened`, `editor_version_history_opened`, `editor_web_version_opened` |
718
+ | AI and discussion | `editor_ai_message_sent`, `editor_ai_reply_received`, `editor_ai_role_selected`, `editor_ai_subject_inserted`, `editor_ai_preheader_inserted`, `editor_comment_sent`, `editor_ai_image_generation_started` |
719
+
720
+ Properties of each event and their values are in **`emailmaker.d.ts`**, **`ExportedApi.DataMixin.AnalyticsEventMap`**.
721
+ An event comes only if the feature behind it is enabled in the configuration.
668
722
 
669
723
  #### Autosave recovery
670
724
 
@@ -11,8 +11,8 @@
11
11
  "src": "../packages/html2amp/rules.json",
12
12
  "isDynamicEntry": true
13
13
  },
14
- "_elMarkupHelper.JLkggsgY.js": {
15
- "file": "js/elMarkupHelper.JLkggsgY.js",
14
+ "_elMarkupHelper.D_gxM3uK.js": {
15
+ "file": "js/elMarkupHelper.D_gxM3uK.js",
16
16
  "name": "elMarkupHelper",
17
17
  "dynamicImports": [
18
18
  "../packages/html2amp/rules.json",
@@ -26,7 +26,7 @@
26
26
  "src": "iframe-eblock.html",
27
27
  "isEntry": true,
28
28
  "imports": [
29
- "_elMarkupHelper.JLkggsgY.js"
29
+ "_elMarkupHelper.D_gxM3uK.js"
30
30
  ]
31
31
  },
32
32
  "iframe.html": {
@@ -35,7 +35,7 @@
35
35
  "src": "iframe.html",
36
36
  "isEntry": true,
37
37
  "imports": [
38
- "_elMarkupHelper.JLkggsgY.js"
38
+ "_elMarkupHelper.D_gxM3uK.js"
39
39
  ]
40
40
  },
41
41
  "js/typograf/typograf.all.js": {
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
5
  <script>var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";e===void 0&&(window.__amdEnv={});var t=window.parent&&window.parent!==window?window.parent:null;if(!t||typeof t.postMessage!=`function`)return;var n=`em:module-body`,r=`em:module-body-ack`,i=1e3,a=6e4,o=300,s={},c={},l=0,u=!1,d=!1;function f(){u||typeof window.addEventListener!=`function`||(u=!0,window.addEventListener(`message`,function(e){var n=e&&e.data;if(n&&typeof n==`object`&&e.source===t){if(n.operationId===r){var i=c[n.for];i&&i();return}var a=s[n.operationId];a&&a(n.data)}}))}function p(e){return d?null:(f(),new Promise(function(r){l+=1;var o=`em:body:`+l,u=`em:body-error:`+l,f=!1,p=null;function m(e){f||(f=!0,p!==null&&window.clearTimeout(p),delete s[o],delete s[u],delete c[o],r(e||null))}s[o]=m,s[u]=function(){m(null)},c[o]=function(){p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){m(null)},a)},p=window.setTimeout(function(){d=!0,m(null)},i),t.postMessage({operationId:n,data:{url:e},result:o,error:u},`*`)}))}window.location&&window.location.protocol===`file:`||(e.moduleTransport=p);var m=null;function h(){m=null;try{t.postMessage({mark:`__emmDiagnostics__`,type:`loader`,items:(e.loaderTimings||[]).slice()},`*`)}catch{}}e.onLoaderTiming=function(){m===null&&(m=window.setTimeout(h,o))}})(),(function(){"use strict";e===void 0&&(window.__amdEnv={}),e.bootCanvas=function(t){e.canvasBooted=!0;var n=!1;function r(){if(!n){n=!0;var e=document.createElement(`script`);e.src=t,document.head.appendChild(e)}}var i=e.moduleTransport;if(typeof i!=`function`){r();return}var a;try{a=i(t,t)}catch{a=null}if(!a||typeof a.then!=`function`){r();return}a.then(function(t){if(!t||n){r();return}n=!0;var i=URL.createObjectURL(t),a=document.createElement(`script`);a.src=i,a.onload=function(){URL.revokeObjectURL(i)},a.onerror=function(){URL.revokeObjectURL(i),e.blobBlocked=!0,n=!1,r()},document.head.appendChild(a)},r)}})();
6
- __useblocks__.bootCanvas("./js/iframe-eblock.js?v=facd6272");</script>
7
- <script defer src="./js/boot-guard.js" data-entry="./js/iframe-eblock.js?v=facd6272" data-ns="__useblocks__"></script>
6
+ __useblocks__.bootCanvas("./js/iframe-eblock.js?v=71aea198");</script>
7
+ <script defer src="./js/boot-guard.js" data-entry="./js/iframe-eblock.js?v=71aea198" data-ns="__useblocks__"></script>
8
8
  </head>
9
9
  <body>
10
10
  </body>
@@ -3,8 +3,8 @@
3
3
  <head>
4
4
  <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
5
5
  <script>var e=window.__useblocks__||(window.__useblocks__={});(function(){"use strict";e===void 0&&(window.__amdEnv={});var t=window.parent&&window.parent!==window?window.parent:null;if(!t||typeof t.postMessage!=`function`)return;var n=`em:module-body`,r=`em:module-body-ack`,i=1e3,a=6e4,o=300,s={},c={},l=0,u=!1,d=!1;function f(){u||typeof window.addEventListener!=`function`||(u=!0,window.addEventListener(`message`,function(e){var n=e&&e.data;if(n&&typeof n==`object`&&e.source===t){if(n.operationId===r){var i=c[n.for];i&&i();return}var a=s[n.operationId];a&&a(n.data)}}))}function p(e){return d?null:(f(),new Promise(function(r){l+=1;var o=`em:body:`+l,u=`em:body-error:`+l,f=!1,p=null;function m(e){f||(f=!0,p!==null&&window.clearTimeout(p),delete s[o],delete s[u],delete c[o],r(e||null))}s[o]=m,s[u]=function(){m(null)},c[o]=function(){p!==null&&window.clearTimeout(p),p=window.setTimeout(function(){m(null)},a)},p=window.setTimeout(function(){d=!0,m(null)},i),t.postMessage({operationId:n,data:{url:e},result:o,error:u},`*`)}))}window.location&&window.location.protocol===`file:`||(e.moduleTransport=p);var m=null;function h(){m=null;try{t.postMessage({mark:`__emmDiagnostics__`,type:`loader`,items:(e.loaderTimings||[]).slice()},`*`)}catch{}}e.onLoaderTiming=function(){m===null&&(m=window.setTimeout(h,o))}})(),(function(){"use strict";e===void 0&&(window.__amdEnv={}),e.bootCanvas=function(t){e.canvasBooted=!0;var n=!1;function r(){if(!n){n=!0;var e=document.createElement(`script`);e.src=t,document.head.appendChild(e)}}var i=e.moduleTransport;if(typeof i!=`function`){r();return}var a;try{a=i(t,t)}catch{a=null}if(!a||typeof a.then!=`function`){r();return}a.then(function(t){if(!t||n){r();return}n=!0;var i=URL.createObjectURL(t),a=document.createElement(`script`);a.src=i,a.onload=function(){URL.revokeObjectURL(i)},a.onerror=function(){URL.revokeObjectURL(i),e.blobBlocked=!0,n=!1,r()},document.head.appendChild(a)},r)}})();
6
- __useblocks__.bootCanvas("./js/iframe.js?v=facd6272");</script>
7
- <script defer src="./js/boot-guard.js" data-entry="./js/iframe.js?v=facd6272" data-ns="__useblocks__"></script>
6
+ __useblocks__.bootCanvas("./js/iframe.js?v=71aea198");</script>
7
+ <script defer src="./js/boot-guard.js" data-entry="./js/iframe.js?v=71aea198" data-ns="__useblocks__"></script>
8
8
  </head>
9
9
  <body>
10
10
  </body>