@numoteq/emdash-plugin-jetemail 0.0.0-stage → 0.1.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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NUMOTEQ s.r.o.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,28 @@
1
- # Temporary Holding Version
1
+ # `@numoteq/emdash-plugin-jetemail`
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Sandbox-compatible [JetEmail](https://jetemail.com) transport provider for EmDash.
4
+
5
+ ## Install
6
+
7
+ ```sh
8
+ pnpm add @numoteq/emdash-plugin-jetemail
9
+ ```
10
+
11
+ Register the package in the site's sandboxed plugin configuration, activate it, then select **JetEmail** under **Settings > Email**. Open the plugin settings and enter:
12
+
13
+ - A JetEmail transactional API key (`transactional_…`) allowed to send from the sender's domain.
14
+ - The sender name and email. The sender domain must be verified in JetEmail.
15
+
16
+ If the domain publishes JetEmail Domain Security (`_jm` TXT), add the API key's UUID to it, otherwise JetEmail rejects the message.
17
+
18
+ The key is stored in the plugin-scoped KV store and is sent only to `https://api.jetemail.com/email`. The plugin requests only the fixed-host network and email transport registration capabilities. Recipients, CC and reply-to are passed through; EmDash email has no attachments.
19
+
20
+ ## Development
21
+
22
+ ```sh
23
+ pnpm test
24
+ pnpm typecheck
25
+ pnpm build
26
+ ```
27
+
28
+ `emdash-plugin build` creates the npm descriptor and sandbox bundle in `dist/`.
@@ -0,0 +1,5 @@
1
+ // Auto-generated by emdash-plugin build. Do not edit.
2
+ import type { PluginDescriptor } from "emdash";
3
+
4
+ declare const descriptor: PluginDescriptor;
5
+ export default descriptor;
package/dist/index.mjs ADDED
@@ -0,0 +1,40 @@
1
+ // Auto-generated by emdash-plugin build. Do not edit.
2
+ // Source: emdash-plugin.jsonc + package.json
3
+ //
4
+ // Default-exports a sandboxed plugin descriptor. Pass it directly into
5
+ // emdash's `plugins:` or `sandboxed:` array — no factory call needed.
6
+
7
+ /** @type {import("emdash").PluginDescriptor} */
8
+ const descriptor = Object.freeze({
9
+ "id": "jetemail",
10
+ "version": "0.1.0",
11
+ "format": "standard",
12
+ "entrypoint": "@numoteq/emdash-plugin-jetemail/sandbox",
13
+ "capabilities": [
14
+ "network:request",
15
+ "hooks.email-transport:register"
16
+ ],
17
+ "allowedHosts": [
18
+ "api.jetemail.com"
19
+ ],
20
+ "storage": {},
21
+ "hooks": [
22
+ {
23
+ "name": "email:deliver",
24
+ "exclusive": true,
25
+ "timeout": 30000
26
+ }
27
+ ],
28
+ "routes": [
29
+ "admin"
30
+ ],
31
+ "adminPages": [
32
+ {
33
+ "path": "/settings",
34
+ "label": "JetEmail",
35
+ "icon": "mail"
36
+ }
37
+ ]
38
+ });
39
+
40
+ export default descriptor;
@@ -0,0 +1,44 @@
1
+ {
2
+ "id": "jetemail",
3
+ "version": "0.1.0",
4
+ "declaredAccess": {
5
+ "network": {
6
+ "request": {
7
+ "allowedHosts": [
8
+ "api.jetemail.com"
9
+ ]
10
+ }
11
+ },
12
+ "email": {
13
+ "transport": {}
14
+ }
15
+ },
16
+ "capabilities": [
17
+ "network:request",
18
+ "hooks.email-transport:register"
19
+ ],
20
+ "allowedHosts": [
21
+ "api.jetemail.com"
22
+ ],
23
+ "storage": {},
24
+ "hooks": [
25
+ {
26
+ "name": "email:deliver",
27
+ "exclusive": true,
28
+ "timeout": 30000
29
+ }
30
+ ],
31
+ "routes": [
32
+ "admin"
33
+ ],
34
+ "admin": {
35
+ "pages": [
36
+ {
37
+ "path": "/settings",
38
+ "label": "JetEmail",
39
+ "icon": "mail"
40
+ }
41
+ ],
42
+ "widgets": []
43
+ }
44
+ }
@@ -0,0 +1,22 @@
1
+ import { SandboxedPlugin } from "emdash/plugin";
2
+
3
+ //#region src/plugin.d.ts
4
+ interface JetEmailSettings {
5
+ apiToken: string;
6
+ fromName: string;
7
+ fromEmail: string;
8
+ }
9
+ interface JetEmailMessage {
10
+ to: string;
11
+ cc?: string[];
12
+ replyTo?: string;
13
+ subject: string;
14
+ text: string;
15
+ html?: string;
16
+ }
17
+ type FetchFn = (url: string, init?: RequestInit) => Promise<Response>;
18
+ declare function formatSender(name: string, email: string): string;
19
+ declare function deliverWithJetEmail(fetchFn: FetchFn, settings: JetEmailSettings, message: JetEmailMessage): Promise<void>;
20
+ declare const plugin: SandboxedPlugin;
21
+ //#endregion
22
+ export { plugin as default, deliverWithJetEmail, formatSender };
@@ -0,0 +1 @@
1
+ function e(e,t){return`${e.replace(/[<>"\r\n]/g,``).trim()} <${t}>`}async function t(t,n,r){let i={from:e(n.fromName,n.fromEmail),to:r.to,subject:r.subject,text:r.text};r.html&&(i.html=r.html),r.cc?.length&&(i.cc=r.cc),r.replyTo&&(i.reply_to=r.replyTo);let a=await t(`https://api.jetemail.com/email`,{method:`POST`,headers:{Authorization:`Bearer ${n.apiToken}`,"Content-Type":`application/json`},body:JSON.stringify(i)});if(!a.ok){let e=(await a.text()).slice(0,500);throw Error(`JetEmail rejected the message with HTTP ${a.status}${e?`: ${e}`:``}`)}}async function n(e){let t=await e.kv.get(`settings:apiToken`),n=await e.kv.get(`settings:fromName`),r=await e.kv.get(`settings:fromEmail`);if(!t||!n||!r)throw Error(`JetEmail is not configured. Set the API key, sender name and sender email.`);return{apiToken:t,fromName:n,fromEmail:r}}async function r(e){let t=await e.kv.get(`settings:fromName`)??``,n=await e.kv.get(`settings:fromEmail`)??``,r=!!await e.kv.get(`settings:apiToken`);return{blocks:[{type:`header`,text:`JetEmail`},{type:`section`,text:`Deliver EmDash transactional email through the JetEmail API. The sender domain must be verified in JetEmail and allowed for the API key.`},{type:`form`,block_id:`jetemail-settings`,fields:[{type:`text_input`,action_id:`fromName`,label:`Sender name`,initial_value:t},{type:`text_input`,action_id:`fromEmail`,label:`Sender email`,initial_value:n},{type:`secret_input`,action_id:`apiToken`,label:r?`Transactional API key (leave blank to keep current)`:`Transactional API key`}],submit:{label:`Save settings`,action_id:`save_settings`}}]}}function i(e){return{blocks:[{type:`banner`,style:`error`,text:e}],toast:{message:e,type:`error`}}}async function a(e,t){let n=typeof t.fromName==`string`?t.fromName.trim():``,a=typeof t.fromEmail==`string`?t.fromEmail.trim():``,o=typeof t.apiToken==`string`?t.apiToken.trim():``;return n.replace(/[<>"\r\n]/g,``).trim()?/^[^\s@<>]+@[^\s@<>]+$/.test(a)?o&&!o.startsWith(`transactional_`)?i(`Use a JetEmail transactional API key (transactional_…).`):(await e.kv.set(`settings:fromName`,n),await e.kv.set(`settings:fromEmail`,a),o&&await e.kv.set(`settings:apiToken`,o),{...await r(e),toast:{message:`JetEmail settings saved`,type:`success`}}):i(`Enter a valid sender email.`):i(`Enter a sender name.`)}const o={hooks:{"email:deliver":{exclusive:!0,timeout:3e4,handler:async(e,r)=>{if(!r.http)throw Error(`JetEmail requires network access.`);let i=await n(r);await t(r.http.fetch.bind(r.http),i,e.message),r.log.info(`Email delivered via JetEmail`,{to:e.message.to,subject:e.message.subject})}}},routes:{admin:{handler:async(e,t)=>{let n=e.input;return n.type===`page_load`&&n.page===`/settings`?r(t):n.type===`form_submit`&&n.action_id===`save_settings`?a(t,n.values??{}):{blocks:[]}}}}};export{o as default,t as deliverWithJetEmail,e as formatSender};
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "./node_modules/@emdash-cms/plugin-cli/schemas/emdash-plugin.schema.json",
3
+ "slug": "jetemail",
4
+ "publisher": "did:plc:nna4pfpnegfsgaym44xqhawf", // numoteq.com
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "NUMOTEQ s.r.o.",
8
+ "url": "https://www.numoteq.com",
9
+ "email": "info@numoteq.com",
10
+ },
11
+ "security": { "email": "info@numoteq.com" },
12
+ "name": "JetEmail",
13
+ "description": "Delivers EmDash transactional email through the JetEmail API.",
14
+ "keywords": ["email", "transactional", "jetemail"],
15
+ "repo": "https://github.com/numoteq/emdash-plugins",
16
+ "capabilities": ["network:request", "hooks.email-transport:register"],
17
+ "allowedHosts": ["api.jetemail.com"],
18
+ "storage": {},
19
+ "admin": {
20
+ "pages": [{ "path": "/settings", "label": "JetEmail", "icon": "mail" }],
21
+ },
22
+ }
package/package.json CHANGED
@@ -1,6 +1,60 @@
1
1
  {
2
- "name": "@numoteq/emdash-plugin-jetemail",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@numoteq/emdash-plugin-jetemail",
3
+ "version": "0.1.0",
4
+ "description": "JetEmail transport provider for EmDash",
5
+ "keywords": [
6
+ "email",
7
+ "emdash",
8
+ "emdash-plugin",
9
+ "jetemail"
10
+ ],
11
+ "homepage": "https://github.com/numoteq/emdash-plugins/tree/main/packages/jetemail#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/numoteq/emdash-plugins/issues"
14
+ },
15
+ "license": "MIT",
16
+ "author": {
17
+ "name": "NUMOTEQ s.r.o.",
18
+ "email": "info@numoteq.com",
19
+ "url": "https://www.numoteq.com"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/numoteq/emdash-plugins.git",
24
+ "directory": "packages/jetemail"
25
+ },
26
+ "files": [
27
+ "dist",
28
+ "emdash-plugin.jsonc",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "type": "module",
33
+ "sideEffects": false,
34
+ "main": "dist/index.mjs",
35
+ "exports": {
36
+ ".": {
37
+ "import": "./dist/index.mjs",
38
+ "types": "./dist/index.d.mts"
39
+ },
40
+ "./sandbox": "./dist/plugin.mjs"
41
+ },
42
+ "publishConfig": {
43
+ "access": "public"
44
+ },
45
+ "scripts": {
46
+ "build": "emdash-plugin validate && emdash-plugin build",
47
+ "dev": "emdash-plugin dev",
48
+ "test": "vitest run",
49
+ "typecheck": "tsc --noEmit"
50
+ },
51
+ "devDependencies": {
52
+ "@emdash-cms/plugin-cli": "0.13.2",
53
+ "emdash": "1.1.0",
54
+ "typescript": "6.0.3",
55
+ "vitest": "5.0.2"
56
+ },
57
+ "peerDependencies": {
58
+ "emdash": ">=1.0.0"
59
+ }
60
+ }