esender-email-editor 1.1.0 → 1.2.1

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/dist/index.d.ts CHANGED
@@ -35,37 +35,6 @@ interface TemplateApiResponse {
35
35
  template?: TemplateDocument;
36
36
  }
37
37
 
38
- /**
39
- * Module-level API configuration for the editor.
40
- *
41
- * Consumers override these via the `apiConfig` prop on <Package />. Internal
42
- * modules (axiosClient, license, template, UploadMedia) read from this module
43
- * instead of hardcoded constants so the editor can talk to any backend that
44
- * implements the same contract.
45
- *
46
- * Endpoint defaults follow the spec paths (e.g. /template/create). The host
47
- * URL (`baseUrl`) defaults to the eSender production API.
48
- *
49
- * Template URLs may contain :projectId / :templateId placeholders, which
50
- * `resolveTemplatePath` substitutes at call time.
51
- */
52
- interface ApiConfig {
53
- /** API host. No trailing slash. */
54
- baseUrl?: string;
55
- /** POST — exchange apiKey for access + refresh tokens. */
56
- verifyUrl?: string;
57
- /** POST — exchange refresh token for new access token. */
58
- refreshUrl?: string;
59
- /** POST — create or update a template (templateId in body for update). */
60
- saveTemplateUrl?: string;
61
- /** GET — load the project's current template. `:projectId` is substituted. */
62
- getTemplatesUrl?: string;
63
- /** GET — load a specific template. `:projectId` / `:templateId` are substituted. */
64
- getTemplateByIdUrl?: string;
65
- /** POST (multipart) — upload an image. Receives a hosted URL back. */
66
- uploadMediaUrl?: string;
67
- }
68
-
69
38
  /**
70
39
  * Editor event callbacks exposed to consumers via <Package />.
71
40
  *
@@ -114,7 +83,18 @@ interface LoadTemplateOptions {
114
83
  interface EditorHandle {
115
84
  getJson: () => any;
116
85
  getHtml: () => any;
117
- loadJson: (json: string, raw?: boolean) => void;
86
+ /**
87
+ * Restore a previously saved template from JSON. Accepts either the raw
88
+ * stringified output of `getJson()` or the deserialized object.
89
+ * Pass `null` to clear the canvas to an empty template.
90
+ */
91
+ loadJson: (json: string | object | null, raw?: boolean) => void;
92
+ /**
93
+ * Load raw HTML into the editor. The HTML is wrapped in an MJML `mj-raw`
94
+ * block and rendered verbatim — the editor cannot break arbitrary HTML
95
+ * back into editable blocks, so for full editability prefer `loadJson`.
96
+ */
97
+ loadHtml: (html: string) => void;
118
98
  /**
119
99
  * Export the current editor state (HTML + JSON) and persist it to the
120
100
  * template API. apiKey comes from the Package's prop. Pass `templateId` to
@@ -134,16 +114,48 @@ interface PackageProps extends EditorEventCallbacks {
134
114
  * backwards-compatible prop signatures during the migration. Ignored at runtime.
135
115
  */
136
116
  projectId?: string;
137
- /**
138
- * Override default API endpoints (base URL + per-route paths). Consumers
139
- * who self-host the backend pass this to point the editor at their server.
140
- */
141
- apiConfig?: ApiConfig;
142
117
  onLicenseError?: (error: LicenseError) => void;
143
118
  customButtons?: ReactNode;
144
119
  showUndoRedo?: boolean;
145
120
  }
146
121
  declare const Package: React.ForwardRefExoticComponent<PackageProps & React.RefAttributes<EditorHandle>>;
147
122
 
123
+ /**
124
+ * Public entry for @bitbeast-private-limited/antd-email-editor.
125
+ *
126
+ * This file is the rollup input — it intentionally exports ONLY the consumer
127
+ * surface. Do NOT export internal utilities, store, contexts, MJML helpers or
128
+ * any other implementation detail from here. Anything re-exported below
129
+ * becomes part of the SDK's public contract and breaks consumers on removal.
130
+ */
131
+
132
+ /**
133
+ * Imperative editor instance returned by `ref.current`. Alias for {@link EditorHandle}.
134
+ */
135
+ type EditorInstance = EditorHandle;
136
+ /**
137
+ * Stored template record returned by the save/load APIs. Alias for {@link TemplateDocument}.
138
+ */
139
+ type TemplateData = TemplateDocument;
140
+ /**
141
+ * MJML JSON tree describing a template. This is the shape `getJson()` produces
142
+ * once parsed back into an object — kept intentionally loose since the tree
143
+ * has many MJML-tag-specific variants.
144
+ */
145
+ type TemplateJson = Record<string, unknown> & {
146
+ tagName: string;
147
+ attributes?: Record<string, unknown>;
148
+ children?: unknown[];
149
+ content?: string;
150
+ };
151
+ /**
152
+ * Arguments accepted by {@link EditorHandle.saveTemplate}. Alias for {@link SaveTemplateOptions}.
153
+ */
154
+ type SaveTemplatePayload = SaveTemplateOptions;
155
+ /**
156
+ * Arguments accepted by {@link EditorHandle.loadTemplate}. Alias for {@link LoadTemplateOptions}.
157
+ */
158
+ type LoadTemplatePayload = LoadTemplateOptions;
159
+
148
160
  export { Package, Package as default };
149
- export type { ApiConfig, EditorEventCallbacks, EditorHandle, LicenseError, LicenseErrorCode, LoadEvent, LoadTemplateOptions, MediaUploadEvent, PackageProps, RefreshTokenResponse, SaveEvent, SaveTemplateOptions, TemplateApiResponse, TemplateDocument, VerifyLicenseResponse };
161
+ export type { EditorEventCallbacks, EditorHandle, EditorInstance, LicenseError, LicenseErrorCode, LoadEvent, LoadTemplateOptions, LoadTemplatePayload, MediaUploadEvent, PackageProps, RefreshTokenResponse, SaveEvent, SaveTemplateOptions, SaveTemplatePayload, TemplateApiResponse, TemplateData, TemplateDocument, TemplateJson, VerifyLicenseResponse };