esender-email-editor 1.1.0 → 1.1.2

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/README.md CHANGED
@@ -11,9 +11,11 @@ A drag-and-drop **MJML email editor** for React 18 + Ant Design 5. The editor re
11
11
  The package is published on the public **npm registry**.
12
12
 
13
13
  ```bash
14
- npm install esender-email-editor
14
+ npm install esender-email-editor --legacy-peer-deps
15
15
  ```
16
16
 
17
+ > `--legacy-peer-deps` is required because `react-giphy-searchbox` (a transitive runtime dependency used by the Gif block) still declares an ancient `react@16.x` peer. The runtime works fine on React 18 — only the metadata is stale.
18
+
17
19
  ## Peer dependencies
18
20
 
19
21
  The package externalizes its heavy runtime deps so the host app provides them. Peer ranges are intentionally permissive — any version within the declared range works, and hosts that already satisfy a peer can skip it.
@@ -116,7 +118,6 @@ export const Composer = () => {
116
118
  | Prop | Type | Required | Description |
117
119
  |---|---|---|---|
118
120
  | `apiKey` | `string` | yes | License key. Exchanged for a JWT on mount. |
119
- | `apiConfig` | `ApiConfig` | no | Override base URL and any endpoint path. See [API configuration](#api-configuration). |
120
121
  | `customButtons` | `ReactNode` | no | Slot rendered in the editor's top-right toolbar. |
121
122
  | `showUndoRedo` | `boolean` | no | Show the undo/redo toolbar (default `true`). |
122
123
  | `onLicenseError` | `(error: LicenseError) => void` | no | Fires when the license verify call fails. |
@@ -134,42 +135,12 @@ export const Composer = () => {
134
135
  | `getJson()` | `string` | Stringified MJML JSON tree (export-ready). |
135
136
  | `getHtml()` | `string` | Compiled email HTML via `mjml-browser`. Triggers `onHtmlExport`. |
136
137
  | `loadJson(json, raw?)` | `void` | Load a previously saved template. `json` is the same string `getJson()` produced. Pass `null` to clear. |
137
- | `saveTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | Create or update a template. Omit `templateId` to create; include it to update. POSTs to the configured `saveTemplateUrl` (default `/template/create`). |
138
- | `loadTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | GET the configured `getTemplatesUrl` or `getTemplateByIdUrl` and pipe the JSON back into `loadJson(...)`. |
139
-
140
- ## API configuration
141
-
142
- The editor talks to a small set of backend endpoints. Defaults point at the hosted eSender API, but every URL is overridable via the `apiConfig` prop so consumers can self-host the backend.
143
-
144
- ```tsx
145
- <Package
146
- ref={ref}
147
- apiKey="…"
148
- apiConfig={{
149
- baseUrl: 'https://api.example.com',
150
- verifyUrl: '/license/verify',
151
- refreshUrl: '/license/refresh',
152
- saveTemplateUrl: '/templates',
153
- getTemplatesUrl: '/templates/:projectId',
154
- getTemplateByIdUrl: '/templates/:projectId/:templateId',
155
- uploadMediaUrl: '/media',
156
- }}
157
- />
158
- ```
138
+ | `saveTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | Create or update a template. Omit `templateId` to create; include it to update. POSTs to `https://esender.in/api/license/template/create`. |
139
+ | `loadTemplate({ projectId, templateId? })` | `Promise<TemplateApiResponse>` | GET from `https://esender.in/api/license/template/:projectId[/:templateId]` and pipe the JSON back into `loadJson(...)`. |
159
140
 
160
- ### Defaults
161
-
162
- | Field | Default | Method | Purpose |
163
- |---|---|---|---|
164
- | `baseUrl` | `https://esender.in/api` | — | Prepended to every relative URL below. |
165
- | `verifyUrl` | `/verify` | POST | Exchange `apiKey` for access + refresh tokens. |
166
- | `refreshUrl` | `/refresh` | POST | Exchange a refresh token for a new access token. |
167
- | `saveTemplateUrl` | `/template/create` | POST | Create (or update, if `templateId` is in the body) a template. |
168
- | `getTemplatesUrl` | `/template/:projectId` | GET | Load the project's current template. |
169
- | `getTemplateByIdUrl` | `/template/:projectId/:templateId` | GET | Load a specific template. |
170
- | `uploadMediaUrl` | `/media/add` | POST (multipart) | Upload an image; returns a hosted URL. |
141
+ ## Backend
171
142
 
172
- Template URLs may contain `:projectId` and `:templateId` placeholders. They're substituted at call time and URL-encoded.
143
+ The editor talks to the hosted eSender API at `https://esender.in/api`. Endpoints are fixed and not configurable; consumers only supply `apiKey`.
173
144
 
174
145
  ## Events
175
146
 
@@ -201,9 +172,9 @@ The editor will not render until the eSender license is verified:
201
172
 
202
173
  1. Host passes `apiKey` to `<Package />`.
203
174
  2. On mount, the package checks `localStorage` for a cached access token.
204
- 3. If absent, it `POST`s to `{baseUrl}{verifyUrl}` (default `https://esender.in/api/verify`) with `x-api-key: <apiKey>`.
175
+ 3. If absent, it `POST`s to `https://esender.in/api/license/verify` with `x-api-key: <apiKey>`.
205
176
  4. On success the returned `accessToken` and `refreshToken` are stored in `localStorage` and the editor mounts.
206
- 5. While running, the internal axios client attaches the access token to protected calls; on `401` / `token expired` it calls `{baseUrl}{refreshUrl}` once and retries. If refresh fails, tokens are cleared and the next mount re-runs verify.
177
+ 5. While running, the internal axios client attaches the access token to protected calls; on `401` / `token expired` it calls `https://esender.in/api/license/refresh` once and retries. If refresh fails, tokens are cleared and the next mount re-runs verify.
207
178
 
208
179
  No further token management is required from the host.
209
180
 
@@ -291,7 +262,6 @@ import Package, {
291
262
  type RefreshTokenResponse,
292
263
  type TemplateApiResponse,
293
264
  type TemplateDocument,
294
- type ApiConfig,
295
265
  type EditorEventCallbacks,
296
266
  type SaveEvent,
297
267
  type LoadEvent,