@emailmaker/extensions-app 1.0.111-dev.5 → 1.0.111-dev.6

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 (3) hide show
  1. package/index.js +11 -7
  2. package/package.json +2 -2
  3. package/types.d.ts +97 -6
package/index.js CHANGED
@@ -107,7 +107,7 @@ var _ = g();
107
107
  n.packages[e.id] = e, n.validateAll();
108
108
  }, t.__compat.registerPackage({
109
109
  id: "extensions-api",
110
- version: "1.0.111-dev.5",
110
+ version: "1.0.111-dev.6",
111
111
  requires: { host: "^1.0.105" }
112
112
  });
113
113
  }
@@ -162,24 +162,28 @@ var x = class {
162
162
  }
163
163
  }, C = class {
164
164
  constructor(e) {
165
- y(this, e, "MessageService");
165
+ y(this, e, "BlocksApi");
166
166
  }
167
167
  }, w = class {
168
168
  constructor(e) {
169
- y(this, e, "SettingsPanelApi");
169
+ y(this, e, "MessageService");
170
170
  }
171
171
  }, T = class {
172
172
  constructor(e) {
173
- y(this, e, "ModalApi");
173
+ y(this, e, "SettingsPanelApi");
174
174
  }
175
175
  }, E = class {
176
+ constructor(e) {
177
+ y(this, e, "ModalApi");
178
+ }
179
+ }, D = class {
176
180
  constructor(e) {
177
181
  y(this, e, "EmailSettingsApi");
178
182
  }
179
183
  };
180
- function D(e = b()) {
184
+ function O(e = b()) {
181
185
  return e;
182
186
  }
183
- var O = d(s.DependencyResolver), k = "1.0.111-dev.5";
187
+ var k = d(s.DependencyResolver), A = "1.0.111-dev.6";
184
188
  //#endregion
185
- export { O as DomComponentRegistry, S as ElementsApi, E as EmailSettingsApi, C as MessageService, T as ModalApi, x as SandboxScriptApi, w as SettingsPanelApi, D as createComponentIdentifier, _ as pluginRegistry, k as version };
189
+ export { C as BlocksApi, k as DomComponentRegistry, S as ElementsApi, D as EmailSettingsApi, w as MessageService, E as ModalApi, x as SandboxScriptApi, T as SettingsPanelApi, O as createComponentIdentifier, _ as pluginRegistry, A as version };
package/package.json CHANGED
@@ -5,8 +5,8 @@
5
5
  "main": "index.js",
6
6
  "types": "types.d.ts",
7
7
  "name": "@emailmaker/extensions-app",
8
- "version": "1.0.111-dev.5",
8
+ "version": "1.0.111-dev.6",
9
9
  "dependencies": {
10
- "@emailmaker/emailmaker": "1.0.111-dev.5"
10
+ "@emailmaker/emailmaker": "1.0.111-dev.6"
11
11
  }
12
12
  }
package/types.d.ts CHANGED
@@ -49,6 +49,81 @@ type MayBePromise$1<Value> = Promise<Value> | Value;
49
49
  interface IDisposable$1 {
50
50
  dispose(): void;
51
51
  }
52
+ /**
53
+ * Payload for `BlocksApi.handleInject` when a block/structure was inserted in the sandbox
54
+ * (mirrors `application_block_inserted` message data).
55
+ */
56
+ interface BlockInjectInfo {
57
+ type?: string;
58
+ name?: string;
59
+ blockId?: string;
60
+ project?: string;
61
+ }
62
+ /**
63
+ * Context passed to ElementsApi.handleBeforeInject before element (atom) HTML is sent to the iframe.
64
+ * Listeners may mutate fields in place and/or return a partial object to merge (SaveEmitter-style).
65
+ */
66
+ interface ElementInsertContext extends Record<string, unknown> {
67
+ name: string;
68
+ className: string;
69
+ html: string;
70
+ }
71
+ /**
72
+ * Context passed to BlocksApi.handleBeforeInject before block HTML is sent to the iframe.
73
+ * `insertFrom` is the editor catalog route (e.g. project / template / common), not REST Block.type taxonomy.
74
+ */
75
+ interface BlockInsertContext extends Record<string, unknown> {
76
+ html: string;
77
+ insertFrom?: string;
78
+ fragmentRole?: 'block' | 'structure';
79
+ /** REST / catalog taxonomy (e.g. block type from API), not the same as `insertFrom`. */
80
+ type?: string;
81
+ name?: string;
82
+ /** Current app project id (route / Redux), not necessarily `Block.project` from REST. */
83
+ project?: string | number;
84
+ id?: string;
85
+ title?: string | null;
86
+ tags?: string[];
87
+ slug?: string;
88
+ description?: string;
89
+ subject?: string;
90
+ blocktags?: number[];
91
+ modified?: string | null;
92
+ author?: string;
93
+ lock?: boolean;
94
+ excerpt?: string | null;
95
+ status?: string;
96
+ is_template?: boolean;
97
+ link?: string;
98
+ renderGuid?: string;
99
+ date?: string | null;
100
+ date_gmt?: string | null;
101
+ modified_gmt?: string | null;
102
+ comment_status?: string;
103
+ ping_status?: string;
104
+ template?: string;
105
+ related_email?: string;
106
+ project_title?: string;
107
+ project_author?: string;
108
+ isAmp?: boolean;
109
+ /** Remaining catalog/API fields not mapped above (shallow copy). */
110
+ catalogExtra?: Record<string, unknown>;
111
+ }
112
+ /**
113
+ * API for block insert lifecycle in the editor (before HTML is sent to the iframe, and after sandbox insert).
114
+ */
115
+ interface IBlocksApi {
116
+ /**
117
+ * Runs before block HTML is posted to the iframe. Listeners receive a mutable context; they may
118
+ * mutate `html` and related fields or return a partial object to merge (SaveEmitter-style).
119
+ */
120
+ handleBeforeInject(listener: (ctx: BlockInsertContext) => MayBePromise$1<Partial<BlockInsertContext> | void>, priority?: number, thisArg?: unknown): IDisposable$1;
121
+ /**
122
+ * Fires after a block or structure was inserted in the sandbox (same channel as `application_block_inserted`).
123
+ * Does not allow changing markup; use {@link handleBeforeInject} to transform HTML before postMessage.
124
+ */
125
+ handleInject(listener: (info: BlockInjectInfo) => void, priority?: number, thisArg?: unknown): IDisposable$1;
126
+ }
52
127
  /**
53
128
  * Information about an element.
54
129
  */
@@ -88,13 +163,19 @@ interface IElementsApi {
88
163
  */
89
164
  insert(element: Element, position?: number): IDisposable$1;
90
165
  /**
91
- * Fires when elements are injected to HTML.
166
+ * Runs before atom HTML is posted to the iframe. Listeners receive a mutable context; they may
167
+ * mutate `html` / `name` / `className` or return a partial object to merge (SaveEmitter-style).
168
+ */
169
+ handleBeforeInject(listener: (ctx: ElementInsertContext) => MayBePromise$1<Partial<ElementInsertContext> | void>, priority?: number, thisArg?: unknown): IDisposable$1;
170
+ /**
171
+ * Fires after an atom is injected into the email HTML in the sandbox. Does not allow changing inserted markup.
172
+ * For transforming HTML before postMessage, use {@link handleBeforeInject}.
92
173
  */
93
174
  handleInject(listener: (elementInfo: {
94
175
  name: string;
95
176
  className: string;
96
177
  html: string;
97
- }) => void, priority?: number, thisArg?: any): IDisposable$1;
178
+ }) => void, priority?: number, thisArg?: unknown): IDisposable$1;
98
179
  }
99
180
  /**
100
181
  * API for interacting with the MessageService.
@@ -350,14 +431,15 @@ declare const DomComponentRegistry: IDomComponentRegistry;
350
431
  // ============================================
351
432
  // EmailSettingsApi
352
433
  // ============================================
353
- /**
354
- * API for working with email settings.
355
- */
356
434
  interface EmailSettingsApi {
357
435
  getEmailLayoutSettings(): Promise<EmailLayoutSettings>;
358
436
  setEmailLayoutSettings(settings: Partial<EmailLayoutSettings>): Promise<void>;
359
437
  getEmailContentStyles(): Promise<EmailContentStyles>;
360
438
  setEmailContentStyles(contentStyles: Partial<EmailContentStyles>): Promise<void>;
439
+ /** Fired after email layout settings change. */
440
+ onChangeEmailLayoutSettings(listener: (settings: EmailLayoutSettings) => void): IDisposable;
441
+ /** Fired after email content styles change. */
442
+ onChangeEmailContentStyles(listener: (contentStyles: EmailContentStyles) => void): IDisposable;
361
443
  }
362
444
  /**
363
445
  * Email layout settings.
@@ -514,6 +596,14 @@ declare class ElementsApi {
514
596
  constructor(editor: Instance);
515
597
  }
516
598
  interface ElementsApi extends IElementsApi {}
599
+ /**
600
+ * @deprecated Use `editor.use('BlocksApi')` to access built-in platform APIs.
601
+ * This compatibility facade will be removed in a future plugin-system package release.
602
+ */
603
+ declare class BlocksApi {
604
+ constructor(editor: Instance);
605
+ }
606
+ interface BlocksApi extends IBlocksApi {}
517
607
  /**
518
608
  * @deprecated Use `editor.use('MessageService')` to access built-in platform APIs.
519
609
  * This compatibility facade will be removed in a future plugin-system package release.
@@ -549,6 +639,7 @@ declare module '@emailmaker/emailmaker' {
549
639
  interface PluginTypeMap {
550
640
  SandboxScriptApi: IPluginConstructor<ISandboxScriptApi>;
551
641
  ElementsApi: IPluginConstructor<IElementsApi>;
642
+ BlocksApi: IPluginConstructor<IBlocksApi>;
552
643
  MessageService: IPluginConstructor<IMessageServiceApi>;
553
644
  SettingsPanelApi: IPluginConstructor<ISettingsPanelApi>;
554
645
  ModalApi: IPluginConstructor<IModalApi>;
@@ -557,4 +648,4 @@ declare module '@emailmaker/emailmaker' {
557
648
  }
558
649
  declare const pluginRegistry: PluginRegistry;
559
650
  declare const version: string;
560
- export { ComponentId, ComponentInput, ComponentInputRegistry, ComponentType, DomComponentRegistry, ElementsApi, EmailContentStyles, EmailLayoutSettings, EmailSettingsApi, type IDisposable, IDomComponent, IDomComponentFactory, IDomComponentRegistry, type ISandboxScriptHandle, Identifier, MayBePromise, MessageService, ModalApi, SandboxScriptApi, SettingsPanelApi, createComponentIdentifier, pluginRegistry, version };
651
+ export { BlocksApi, ComponentId, ComponentInput, ComponentInputRegistry, ComponentType, DomComponentRegistry, ElementsApi, EmailContentStyles, EmailLayoutSettings, EmailSettingsApi, type IDisposable, IDomComponent, IDomComponentFactory, IDomComponentRegistry, type ISandboxScriptHandle, Identifier, MayBePromise, MessageService, ModalApi, SandboxScriptApi, SettingsPanelApi, createComponentIdentifier, pluginRegistry, version };