@templatical/import-easy-email-pro 0.36.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.
- package/LICENSE +21 -0
- package/README.md +51 -0
- package/dist/index.d.ts +77 -0
- package/dist/index.js +1330 -0
- package/dist/index.js.map +1 -0
- package/package.json +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026-present Templatical
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# @templatical/import-easy-email-pro
|
|
2
|
+
|
|
3
|
+
Convert Easy Email Pro email templates to Templatical format.
|
|
4
|
+
|
|
5
|
+
Reads an Easy Email Pro persist document — the `{ subject, content }` envelope
|
|
6
|
+
the editor saves, or a bare `type: "page"` element — into a Templatical
|
|
7
|
+
`TemplateContent` tree. The input is that persist JSON, not `EditorCore.toMJML()`
|
|
8
|
+
and not the compiled HTML. Open-source Easy Email (`type: "section"` / `"text"`
|
|
9
|
+
without the `standard-` prefix) is a different format; this package throws
|
|
10
|
+
rather than mis-import it.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
npm install @templatical/import-easy-email-pro
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { convertEasyEmailProTemplate } from "@templatical/import-easy-email-pro";
|
|
22
|
+
|
|
23
|
+
const { content, report } = convertEasyEmailProTemplate(emailTemplate);
|
|
24
|
+
|
|
25
|
+
console.log(report.summary);
|
|
26
|
+
console.log(report.warnings);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
`emailTemplate` is `{ subject, content }` with `content.type === "page"`, or
|
|
30
|
+
the page element itself. `convertEasyEmailProTemplate` also accepts either
|
|
31
|
+
shape serialized as a JSON string. Extra `html` / `mjml` keys on the envelope
|
|
32
|
+
are ignored.
|
|
33
|
+
|
|
34
|
+
Each entry in `report.entries` carries a `status`:
|
|
35
|
+
|
|
36
|
+
- `converted` — mapped to a Templatical block with no loss of fidelity.
|
|
37
|
+
- `approximated` — mapped to a Templatical block, but something had to be
|
|
38
|
+
resolved or clamped (e.g. a 4+ column row folded to three, an outlined
|
|
39
|
+
button, a hero overlay stacked as a leading image, a countdown GIF, a
|
|
40
|
+
widget whose children converted without its chrome, logic whose children
|
|
41
|
+
converted without their expression).
|
|
42
|
+
- `html-fallback` — no Templatical block exists for this `type`; the raw node
|
|
43
|
+
is preserved as JSON inside an `HtmlBlock`.
|
|
44
|
+
- `skipped` — empty `logic`; there were no children to convert.
|
|
45
|
+
|
|
46
|
+
See [Migrating from Easy Email Pro](https://docs.templatical.com/guide/migration-from-easy-email-pro)
|
|
47
|
+
for the full node-mapping table and what does not survive the conversion.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
type ConversionStatus = "converted" | "approximated" | "html-fallback" | "skipped";
|
|
3
|
+
interface ImportReportEntry {
|
|
4
|
+
/** The source Easy Email Pro `type` string (e.g. "standard-button"). */
|
|
5
|
+
sourceTag: string;
|
|
6
|
+
templaticalBlockType: string | null;
|
|
7
|
+
status: ConversionStatus;
|
|
8
|
+
note?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ImportReport {
|
|
11
|
+
entries: ImportReportEntry[];
|
|
12
|
+
warnings: string[];
|
|
13
|
+
summary: {
|
|
14
|
+
total: number;
|
|
15
|
+
converted: number;
|
|
16
|
+
approximated: number;
|
|
17
|
+
htmlFallback: number;
|
|
18
|
+
skipped: number;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
interface ImportResult {
|
|
22
|
+
content: import("@templatical/types").TemplateContent;
|
|
23
|
+
report: ImportReport;
|
|
24
|
+
}
|
|
25
|
+
interface EasyEmailProNode {
|
|
26
|
+
type?: string;
|
|
27
|
+
data?: Record<string, unknown>;
|
|
28
|
+
attributes?: Record<string, unknown>;
|
|
29
|
+
mobileAttributes?: Record<string, unknown>;
|
|
30
|
+
visible?: "desktop" | "mobile" | string;
|
|
31
|
+
logic?: {
|
|
32
|
+
condition?: unknown;
|
|
33
|
+
iteration?: unknown;
|
|
34
|
+
};
|
|
35
|
+
children?: Array<EasyEmailProNode | EasyEmailProTextNode>;
|
|
36
|
+
title?: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
uid?: string;
|
|
39
|
+
[key: string]: unknown;
|
|
40
|
+
}
|
|
41
|
+
interface EasyEmailProTextNode {
|
|
42
|
+
text: string;
|
|
43
|
+
bold?: boolean;
|
|
44
|
+
italic?: boolean;
|
|
45
|
+
underline?: boolean;
|
|
46
|
+
strikethrough?: boolean;
|
|
47
|
+
color?: string;
|
|
48
|
+
bgColor?: string;
|
|
49
|
+
link?: {
|
|
50
|
+
href?: string;
|
|
51
|
+
blank?: boolean;
|
|
52
|
+
} | null;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
type EasyEmailProPage = EasyEmailProNode & {
|
|
56
|
+
type: "page";
|
|
57
|
+
};
|
|
58
|
+
interface EasyEmailProDocument {
|
|
59
|
+
subject?: string;
|
|
60
|
+
content?: EasyEmailProPage | EasyEmailProNode;
|
|
61
|
+
html?: unknown;
|
|
62
|
+
mjml?: unknown;
|
|
63
|
+
thumbnail?: unknown;
|
|
64
|
+
id?: unknown;
|
|
65
|
+
[key: string]: unknown;
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/converter.d.ts
|
|
69
|
+
/**
|
|
70
|
+
* Convert an Easy Email Pro page (or EmailTemplate envelope) into a
|
|
71
|
+
* Templatical template. Accepts a bare `page` element, an
|
|
72
|
+
* `EmailTemplate { subject, content }` envelope, or a JSON string of either.
|
|
73
|
+
*/
|
|
74
|
+
export declare function convertEasyEmailProTemplate(doc: EasyEmailProDocument | EasyEmailProPage | string): ImportResult;
|
|
75
|
+
//#endregion
|
|
76
|
+
export type { ConversionStatus, ImportReport, ImportReportEntry, ImportResult };
|
|
77
|
+
//# sourceMappingURL=index.d.ts.map
|