esender-email-editor 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/LICENSE +21 -0
- package/README.md +249 -0
- package/dist/index.cjs +101 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +101 -0
- package/dist/styles.css +1 -0
- package/package.json +128 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
type LicenseErrorCode = 'MISSING_API_KEY' | 'INVALID_LICENSE' | 'INVALID_TOKEN' | 'NETWORK_ERROR' | 'UNKNOWN_ERROR';
|
|
4
|
+
interface LicenseError {
|
|
5
|
+
code: LicenseErrorCode;
|
|
6
|
+
message: string;
|
|
7
|
+
}
|
|
8
|
+
interface VerifyLicenseResponse {
|
|
9
|
+
status: boolean;
|
|
10
|
+
success: boolean;
|
|
11
|
+
message: string;
|
|
12
|
+
accessToken: string;
|
|
13
|
+
refreshToken: string;
|
|
14
|
+
}
|
|
15
|
+
interface RefreshTokenResponse {
|
|
16
|
+
status: boolean;
|
|
17
|
+
success: boolean;
|
|
18
|
+
message: string;
|
|
19
|
+
accessToken: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface TemplateDocument {
|
|
23
|
+
_id: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
projectId: string;
|
|
26
|
+
HTML: string;
|
|
27
|
+
JSON: unknown;
|
|
28
|
+
createdAt?: string;
|
|
29
|
+
updatedAt?: string;
|
|
30
|
+
}
|
|
31
|
+
interface TemplateApiResponse {
|
|
32
|
+
status: boolean;
|
|
33
|
+
message: string;
|
|
34
|
+
template?: TemplateDocument;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface SaveTemplateOptions {
|
|
38
|
+
projectId: string;
|
|
39
|
+
}
|
|
40
|
+
interface LoadTemplateOptions {
|
|
41
|
+
projectId: string;
|
|
42
|
+
/** Optional — when omitted, loads the project's single current template. */
|
|
43
|
+
templateId?: string;
|
|
44
|
+
}
|
|
45
|
+
interface EditorHandle {
|
|
46
|
+
getJson: () => any;
|
|
47
|
+
getHtml: () => any;
|
|
48
|
+
loadJson: (json: string, raw?: boolean) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Export the current editor state (HTML + JSON) and persist it to the
|
|
51
|
+
* eSender template API. apiKey comes from the Package's prop.
|
|
52
|
+
*/
|
|
53
|
+
saveTemplate: (options: SaveTemplateOptions) => Promise<TemplateApiResponse>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetch a saved template from the API and load its JSON into the editor.
|
|
56
|
+
* If `templateId` is omitted the project's current template is loaded.
|
|
57
|
+
*/
|
|
58
|
+
loadTemplate: (options: LoadTemplateOptions) => Promise<TemplateApiResponse>;
|
|
59
|
+
}
|
|
60
|
+
interface PackageProps {
|
|
61
|
+
apiKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* @deprecated The new eSender license flow does not use projectId. Kept for
|
|
64
|
+
* backwards-compatible prop signatures during the migration. Ignored at runtime.
|
|
65
|
+
*/
|
|
66
|
+
projectId?: string;
|
|
67
|
+
onLicenseError?: (error: LicenseError) => void;
|
|
68
|
+
customButtons?: ReactNode;
|
|
69
|
+
showUndoRedo?: boolean;
|
|
70
|
+
}
|
|
71
|
+
declare const Package: React.ForwardRefExoticComponent<PackageProps & React.RefAttributes<EditorHandle>>;
|
|
72
|
+
|
|
73
|
+
export { Package, Package as default };
|
|
74
|
+
export type { EditorHandle, LicenseError, LicenseErrorCode, LoadTemplateOptions, PackageProps, RefreshTokenResponse, SaveTemplateOptions, TemplateApiResponse, TemplateDocument, VerifyLicenseResponse };
|