@one-million-lines/email-builder 0.3.0 → 0.4.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/CHANGELOG.md +51 -0
- package/dist/core/plugins.d.ts +3 -1
- package/dist/core/types.d.ts +26 -0
- package/dist/core/validation.d.ts +4 -0
- package/dist/email-builder.cjs +6 -6
- package/dist/email-builder.cjs.map +1 -1
- package/dist/email-builder.js +2320 -2189
- package/dist/email-builder.js.map +1 -1
- package/dist/index.d.ts +16 -2
- package/dist/modules/helpers.d.ts +28 -1
- package/dist/plugins/mergeTags/state.d.ts +8 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmailDocument, Theme } from './core/types';
|
|
1
|
+
import { EmailDocument, Theme, MergeTag } from './core/types';
|
|
2
2
|
import { documentSchema } from './core/validation';
|
|
3
3
|
import { renderEmailHtml } from './core/renderer';
|
|
4
4
|
import { ModuleDefinition } from './modules/registry';
|
|
@@ -31,6 +31,20 @@ export interface EmailBuilderProps {
|
|
|
31
31
|
* Ignored when `voucherProvider` is provided.
|
|
32
32
|
*/
|
|
33
33
|
voucherEndpoint?: string | VoucherOptions;
|
|
34
|
+
/**
|
|
35
|
+
* List of merge tags (personalisation tokens) available in the text element
|
|
36
|
+
* sidebar. When configured, a "Insert merge tag" dropdown appears allowing
|
|
37
|
+
* the user to insert `{attribute}` placeholders into text content.
|
|
38
|
+
*
|
|
39
|
+
* Example:
|
|
40
|
+
* ```ts
|
|
41
|
+
* mergeTags={[
|
|
42
|
+
* { attribute: "user.firstname", title: "First name" },
|
|
43
|
+
* { attribute: "user.lastname", title: "Last name" },
|
|
44
|
+
* ]}
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
mergeTags?: MergeTag[];
|
|
34
48
|
onChange?: (doc: EmailDocument) => void;
|
|
35
49
|
onExportHtml?: (html: string) => void;
|
|
36
50
|
}
|
|
@@ -47,7 +61,7 @@ export interface VanillaInstance {
|
|
|
47
61
|
exportJson: () => string;
|
|
48
62
|
}
|
|
49
63
|
export declare function createEmailBuilder(opts: VanillaOptions): VanillaInstance;
|
|
50
|
-
export type { Plugin, ModuleDefinition, AIProvider, EmailDocument, Theme };
|
|
64
|
+
export type { Plugin, ModuleDefinition, AIProvider, EmailDocument, Theme, MergeTag };
|
|
51
65
|
export { registerPlugin, renderEmailHtml, documentSchema };
|
|
52
66
|
export { imageUploaderPlugin } from './plugins/imageUploader';
|
|
53
67
|
export type { ImageUploaderOptions } from './plugins/imageUploader';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { EmailElement, EmailModule, Product, ProductGridElement } from '../core/types';
|
|
1
|
+
import { EmailElement, EmailModule, Product, ProductGridElement, SpecialLinkType } from '../core/types';
|
|
2
2
|
export declare const text: (content: string, opts?: Partial<{
|
|
3
3
|
role: "headline" | "subheadline" | "body" | "caption" | "voucherCode";
|
|
4
4
|
fontSize: number;
|
|
@@ -13,6 +13,7 @@ export declare const text: (content: string, opts?: Partial<{
|
|
|
13
13
|
lineHeight: number;
|
|
14
14
|
letterSpacing: number;
|
|
15
15
|
link: string;
|
|
16
|
+
linkType: SpecialLinkType;
|
|
16
17
|
mobile: Record<string, unknown>;
|
|
17
18
|
}>) => EmailElement;
|
|
18
19
|
export declare const image: (src: string, alt: string, opts?: Partial<{
|
|
@@ -33,6 +34,7 @@ export declare const button: (label: string, link?: string, opts?: Partial<{
|
|
|
33
34
|
borderRadius: number;
|
|
34
35
|
paddingTop: number;
|
|
35
36
|
paddingBottom: number;
|
|
37
|
+
linkType: SpecialLinkType;
|
|
36
38
|
mobile: Record<string, unknown>;
|
|
37
39
|
}>) => EmailElement;
|
|
38
40
|
export declare const spacer: (height?: number) => EmailElement;
|
|
@@ -62,6 +64,7 @@ export declare const muted: (content: string, opts?: {
|
|
|
62
64
|
paddingBottom?: number;
|
|
63
65
|
lineHeight?: number;
|
|
64
66
|
link?: string;
|
|
67
|
+
linkType?: SpecialLinkType;
|
|
65
68
|
letterSpacing?: number;
|
|
66
69
|
}) => EmailElement;
|
|
67
70
|
export declare const voucherCode: (code: string, opts?: {
|
|
@@ -92,3 +95,27 @@ export declare const productGrid: (products: Product[], opts?: Partial<{
|
|
|
92
95
|
paddingLeft: number;
|
|
93
96
|
paddingRight: number;
|
|
94
97
|
}>) => ProductGridElement;
|
|
98
|
+
/**
|
|
99
|
+
* Creates a text element whose content is a series of inline `<a>` links,
|
|
100
|
+
* each carrying a `data-link-type` attribute so backend processors can
|
|
101
|
+
* identify and replace the placeholder href with a real per-recipient URL.
|
|
102
|
+
*
|
|
103
|
+
* Usage:
|
|
104
|
+
* ```ts
|
|
105
|
+
* footerLinks([
|
|
106
|
+
* { label: "Unsubscribe", type: "unsubscribe" },
|
|
107
|
+
* { label: "View in browser", type: "view_in_browser" },
|
|
108
|
+
* ], { align: "center", fontSize: 12 })
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
export declare const footerLinks: (links: {
|
|
112
|
+
label: string;
|
|
113
|
+
type: SpecialLinkType;
|
|
114
|
+
}[], opts?: {
|
|
115
|
+
align?: "left" | "center" | "right";
|
|
116
|
+
fontSize?: number;
|
|
117
|
+
color?: string;
|
|
118
|
+
paddingTop?: number;
|
|
119
|
+
paddingBottom?: number;
|
|
120
|
+
separator?: string;
|
|
121
|
+
}) => EmailElement;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MergeTag } from '../../core/types';
|
|
2
|
+
interface MergeTagsState {
|
|
3
|
+
mergeTags: MergeTag[];
|
|
4
|
+
setMergeTags: (tags: MergeTag[]) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare const useMergeTagsStore: import('zustand').UseBoundStore<import('zustand').StoreApi<MergeTagsState>>;
|
|
7
|
+
export declare function setMergeTagsGlobal(tags: MergeTag[]): void;
|
|
8
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one-million-lines/email-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Embeddable visual email builder (React + vanilla JS) that composes modular marketing emails from a JSON model and exports table-based HTML.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|