zupost 0.6.0 → 0.6.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/README.md CHANGED
@@ -53,7 +53,7 @@ await zupost.emails.send({
53
53
 
54
54
  #### Fallback: inline content
55
55
 
56
- When a template is not a good fit, you can pass raw content instead. Exactly one of `html`, `markdown`, or `react` is required in that case.
56
+ When a template is not a good fit, you can pass raw content instead. At least one of `html`, `markdown`, `react`, or `text` is required in that case. `html`, `markdown`, and `react` are mutually exclusive, while `text` can be sent on its own or added alongside one of them as a plain text alternative.
57
57
 
58
58
  ```typescript
59
59
  // Inline HTML
@@ -71,6 +71,14 @@ await zupost.emails.send({
71
71
  subject: 'Team Update',
72
72
  markdown: '# Hello Team\n\nThis is a **markdown** email.',
73
73
  });
74
+
75
+ // Plain text only
76
+ await zupost.emails.send({
77
+ from: 'sender@example.com',
78
+ to: 'recipient@example.com',
79
+ subject: 'Hello World',
80
+ text: 'Hello! This is a plain text email.',
81
+ });
74
82
  ```
75
83
 
76
84
  ### Send with React Email (fallback)
package/dist/index.d.mts CHANGED
@@ -21,8 +21,10 @@ declare class HttpClient {
21
21
  *
22
22
  * Zupost is template first: the recommended way to send is by providing a
23
23
  * `templateId` (managed in the Zupost dashboard) together with `variables`.
24
- * `html`, `markdown`, and `react` are supported as fallbacks for ad-hoc or
25
- * dynamically generated content. Exactly one content source is required.
24
+ * `html`, `markdown`, `react`, and `text` are supported as fallbacks for
25
+ * ad-hoc or dynamically generated content. At least one content source is
26
+ * required. `html`, `markdown`, and `react` are mutually exclusive, while
27
+ * `text` may be sent on its own or alongside one of them.
26
28
  */
27
29
  interface SendEmailOptions {
28
30
  /**
@@ -82,7 +84,9 @@ interface SendEmailOptions {
82
84
  */
83
85
  reactOptions?: Options;
84
86
  /**
85
- * Plain text content for the email.
87
+ * Plain text content for the email. Can be sent on its own as the only
88
+ * content source, or alongside `html`, `markdown`, or `react` to provide a
89
+ * plain text alternative.
86
90
  */
87
91
  text?: string;
88
92
  /**
package/dist/index.d.ts CHANGED
@@ -21,8 +21,10 @@ declare class HttpClient {
21
21
  *
22
22
  * Zupost is template first: the recommended way to send is by providing a
23
23
  * `templateId` (managed in the Zupost dashboard) together with `variables`.
24
- * `html`, `markdown`, and `react` are supported as fallbacks for ad-hoc or
25
- * dynamically generated content. Exactly one content source is required.
24
+ * `html`, `markdown`, `react`, and `text` are supported as fallbacks for
25
+ * ad-hoc or dynamically generated content. At least one content source is
26
+ * required. `html`, `markdown`, and `react` are mutually exclusive, while
27
+ * `text` may be sent on its own or alongside one of them.
26
28
  */
27
29
  interface SendEmailOptions {
28
30
  /**
@@ -82,7 +84,9 @@ interface SendEmailOptions {
82
84
  */
83
85
  reactOptions?: Options;
84
86
  /**
85
- * Plain text content for the email.
87
+ * Plain text content for the email. Can be sent on its own as the only
88
+ * content source, or alongside `html`, `markdown`, or `react` to provide a
89
+ * plain text alternative.
86
90
  */
87
91
  text?: string;
88
92
  /**
package/dist/index.js CHANGED
@@ -79,7 +79,7 @@ __export(index_exports, {
79
79
  module.exports = __toCommonJS(index_exports);
80
80
 
81
81
  // package.json
82
- var version = "0.6.0";
82
+ var version = "0.6.1";
83
83
 
84
84
  // src/errors.ts
85
85
  var ZupostError = class _ZupostError extends Error {
@@ -267,8 +267,10 @@ var Emails = class {
267
267
  if (inlineCount > 1) {
268
268
  throw new Error("Provide only one of html, markdown, or react");
269
269
  }
270
- if (inlineCount === 0 && !options.templateId) {
271
- throw new Error("Provide one of html, markdown, react, or templateId");
270
+ if (inlineCount === 0 && !options.templateId && !options.text) {
271
+ throw new Error(
272
+ "Provide one of html, markdown, react, text, or templateId"
273
+ );
272
274
  }
273
275
  const payload = __spreadValues({}, options);
274
276
  if (options.react) {
package/dist/index.mjs CHANGED
@@ -44,7 +44,7 @@ var __async = (__this, __arguments, generator) => {
44
44
  };
45
45
 
46
46
  // package.json
47
- var version = "0.6.0";
47
+ var version = "0.6.1";
48
48
 
49
49
  // src/errors.ts
50
50
  var ZupostError = class _ZupostError extends Error {
@@ -232,8 +232,10 @@ var Emails = class {
232
232
  if (inlineCount > 1) {
233
233
  throw new Error("Provide only one of html, markdown, or react");
234
234
  }
235
- if (inlineCount === 0 && !options.templateId) {
236
- throw new Error("Provide one of html, markdown, react, or templateId");
235
+ if (inlineCount === 0 && !options.templateId && !options.text) {
236
+ throw new Error(
237
+ "Provide one of html, markdown, react, text, or templateId"
238
+ );
237
239
  }
238
240
  const payload = __spreadValues({}, options);
239
241
  if (options.react) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zupost",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Node.js SDK for Zupost",
5
5
  "engines": {
6
6
  "node": ">=20"