hivewrite-sdk 1.0.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/index.d.ts ADDED
@@ -0,0 +1,37 @@
1
+ export interface SDKConfig {
2
+ apiKey: string;
3
+ container: string | HTMLElement;
4
+ mode: 'FULL_EDITOR' | 'DESIGN_ONLY' | 'READ_ONLY' | 'HTML_IMPORT';
5
+ user?: { id: string; email: string };
6
+ branding?: {
7
+ hidePoweredBy?: boolean;
8
+ primaryColor?: string;
9
+ logoUrl?: string;
10
+ customCSS?: string;
11
+ };
12
+ mergeTags?: { label: string; value: string }[];
13
+ callbacks?: {
14
+ onLoad?: () => void;
15
+ onSave?: (jsonDesign: any) => void;
16
+ onExport?: (html: string) => void;
17
+ onError?: (err: any) => void;
18
+ onImageUpload?: (file: File) => Promise<string>;
19
+ onTemplateChange?: (templateId: string) => void;
20
+ };
21
+ }
22
+
23
+ export interface EmailEditorSDK {
24
+ init(config: SDKConfig): void;
25
+ loadTemplate(data: { templateId?: string; design?: any }): void;
26
+ saveDesign(callback?: (json: any) => void): any;
27
+ exportHtml(callback?: (html: string) => void): string;
28
+ importHTML(data: { html: string }): void;
29
+ }
30
+
31
+ export const EmailEditor: EmailEditorSDK;
32
+
33
+ declare global {
34
+ interface Window {
35
+ EmailEditor: EmailEditorSDK;
36
+ }
37
+ }
package/index.js ADDED
@@ -0,0 +1,7 @@
1
+ if (typeof window !== 'undefined') {
2
+ require('./bundle.min.js');
3
+ }
4
+
5
+ module.exports = {
6
+ EmailEditor: typeof window !== 'undefined' ? window.EmailEditor : null
7
+ };
package/package.json ADDED
@@ -0,0 +1,17 @@
1
+ {
2
+ "name": "hivewrite-sdk",
3
+ "version": "1.0.0",
4
+ "description": "Email Editor SDK for React and JavaScript applications",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "license": "MIT",
8
+ "files": [
9
+ "bundle.min.js",
10
+ "index.js",
11
+ "index.d.ts",
12
+ "README.md"
13
+ ],
14
+ "publishConfig": {
15
+ "access": "public"
16
+ }
17
+ }