@emailmaker/extensions-app 1.0.111-dev.4 → 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.
- package/index.js +11 -7
- package/package.json +2 -2
- package/types.d.ts +114 -8
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.
|
|
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, "
|
|
165
|
+
y(this, e, "BlocksApi");
|
|
166
166
|
}
|
|
167
167
|
}, w = class {
|
|
168
168
|
constructor(e) {
|
|
169
|
-
y(this, e, "
|
|
169
|
+
y(this, e, "MessageService");
|
|
170
170
|
}
|
|
171
171
|
}, T = class {
|
|
172
172
|
constructor(e) {
|
|
173
|
-
y(this, e, "
|
|
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
|
|
184
|
+
function O(e = b()) {
|
|
181
185
|
return e;
|
|
182
186
|
}
|
|
183
|
-
var
|
|
187
|
+
var k = d(s.DependencyResolver), A = "1.0.111-dev.6";
|
|
184
188
|
//#endregion
|
|
185
|
-
export {
|
|
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.
|
|
8
|
+
"version": "1.0.111-dev.6",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@emailmaker/emailmaker": "1.0.111-dev.
|
|
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
|
-
*
|
|
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?:
|
|
178
|
+
}) => void, priority?: number, thisArg?: unknown): IDisposable$1;
|
|
98
179
|
}
|
|
99
180
|
/**
|
|
100
181
|
* API for interacting with the MessageService.
|
|
@@ -212,6 +293,21 @@ interface IModalApi {
|
|
|
212
293
|
/**
|
|
213
294
|
* API for managing styles and scripts in a sandboxed environment (e.g., an iframe).
|
|
214
295
|
*/
|
|
296
|
+
interface ISandboxScriptHandle extends IDisposable$1 {
|
|
297
|
+
/**
|
|
298
|
+
* Resolves when the corresponding sandbox `<script>` tag is loaded in iframe.
|
|
299
|
+
* Rejects if script loading fails or registration is disposed before load completes.
|
|
300
|
+
*/
|
|
301
|
+
readonly loaded: Promise<void>;
|
|
302
|
+
/**
|
|
303
|
+
* Resolves when sandbox script is ready to receive messages.
|
|
304
|
+
* If script did not synchronously create sandbox plugins during evaluation,
|
|
305
|
+
* `ready` resolves together with `loaded`.
|
|
306
|
+
* If it did, `ready` waits until those synchronously created plugins finish
|
|
307
|
+
* lifecycle initialization (`afterInit`).
|
|
308
|
+
*/
|
|
309
|
+
readonly ready: Promise<void>;
|
|
310
|
+
}
|
|
215
311
|
interface ISandboxScriptApi {
|
|
216
312
|
/**
|
|
217
313
|
* Registers an external CSS file inside the sandboxed environment.
|
|
@@ -224,11 +320,11 @@ interface ISandboxScriptApi {
|
|
|
224
320
|
/**
|
|
225
321
|
* Registers an external JavaScript file inside the sandboxed environment.
|
|
226
322
|
*/
|
|
227
|
-
registerSandboxScript(url: string):
|
|
323
|
+
registerSandboxScript(url: string): ISandboxScriptHandle;
|
|
228
324
|
/**
|
|
229
325
|
* Registers a block of JavaScript code inside the sandboxed environment.
|
|
230
326
|
*/
|
|
231
|
-
registerSandboxScriptCode(key: string, code: string):
|
|
327
|
+
registerSandboxScriptCode(key: string, code: string): ISandboxScriptHandle;
|
|
232
328
|
}
|
|
233
329
|
/**
|
|
234
330
|
* Options for adding extra tabs in the interface.
|
|
@@ -335,14 +431,15 @@ declare const DomComponentRegistry: IDomComponentRegistry;
|
|
|
335
431
|
// ============================================
|
|
336
432
|
// EmailSettingsApi
|
|
337
433
|
// ============================================
|
|
338
|
-
/**
|
|
339
|
-
* API for working with email settings.
|
|
340
|
-
*/
|
|
341
434
|
interface EmailSettingsApi {
|
|
342
435
|
getEmailLayoutSettings(): Promise<EmailLayoutSettings>;
|
|
343
436
|
setEmailLayoutSettings(settings: Partial<EmailLayoutSettings>): Promise<void>;
|
|
344
437
|
getEmailContentStyles(): Promise<EmailContentStyles>;
|
|
345
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;
|
|
346
443
|
}
|
|
347
444
|
/**
|
|
348
445
|
* Email layout settings.
|
|
@@ -499,6 +596,14 @@ declare class ElementsApi {
|
|
|
499
596
|
constructor(editor: Instance);
|
|
500
597
|
}
|
|
501
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 {}
|
|
502
607
|
/**
|
|
503
608
|
* @deprecated Use `editor.use('MessageService')` to access built-in platform APIs.
|
|
504
609
|
* This compatibility facade will be removed in a future plugin-system package release.
|
|
@@ -534,6 +639,7 @@ declare module '@emailmaker/emailmaker' {
|
|
|
534
639
|
interface PluginTypeMap {
|
|
535
640
|
SandboxScriptApi: IPluginConstructor<ISandboxScriptApi>;
|
|
536
641
|
ElementsApi: IPluginConstructor<IElementsApi>;
|
|
642
|
+
BlocksApi: IPluginConstructor<IBlocksApi>;
|
|
537
643
|
MessageService: IPluginConstructor<IMessageServiceApi>;
|
|
538
644
|
SettingsPanelApi: IPluginConstructor<ISettingsPanelApi>;
|
|
539
645
|
ModalApi: IPluginConstructor<IModalApi>;
|
|
@@ -542,4 +648,4 @@ declare module '@emailmaker/emailmaker' {
|
|
|
542
648
|
}
|
|
543
649
|
declare const pluginRegistry: PluginRegistry;
|
|
544
650
|
declare const version: string;
|
|
545
|
-
export { ComponentId, ComponentInput, ComponentInputRegistry, ComponentType, DomComponentRegistry, ElementsApi, EmailContentStyles, EmailLayoutSettings, EmailSettingsApi, type IDisposable, IDomComponent, IDomComponentFactory, IDomComponentRegistry, 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 };
|