@formepdf/resend 0.5.0 → 0.6.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/README.md +8 -4
- package/dist/send-pdf.d.ts +1 -3
- package/dist/send-pdf.js +1 -5
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ npm install @formepdf/resend resend @formepdf/react @formepdf/core
|
|
|
13
13
|
```typescript
|
|
14
14
|
import { sendPdf } from '@formepdf/resend';
|
|
15
15
|
|
|
16
|
-
await sendPdf({
|
|
16
|
+
const { data, error } = await sendPdf({
|
|
17
17
|
resendApiKey: process.env.RESEND_API_KEY,
|
|
18
18
|
from: 'Acme Corp <billing@acme.com>',
|
|
19
19
|
to: 'customer@email.com',
|
|
@@ -33,9 +33,13 @@ await sendPdf({
|
|
|
33
33
|
paymentTerms: 'Net 30',
|
|
34
34
|
},
|
|
35
35
|
});
|
|
36
|
+
|
|
37
|
+
if (error) {
|
|
38
|
+
console.error(error.message);
|
|
39
|
+
}
|
|
36
40
|
```
|
|
37
41
|
|
|
38
|
-
One call. PDF rendered, email sent, invoice attached.
|
|
42
|
+
One call. PDF rendered, email sent, invoice attached. Returns Resend's `{ data, error }` shape.
|
|
39
43
|
|
|
40
44
|
## Custom Templates
|
|
41
45
|
|
|
@@ -43,7 +47,7 @@ One call. PDF rendered, email sent, invoice attached.
|
|
|
43
47
|
import { sendPdf } from '@formepdf/resend';
|
|
44
48
|
import { MyTemplate } from './my-template';
|
|
45
49
|
|
|
46
|
-
await sendPdf({
|
|
50
|
+
const { data, error } = await sendPdf({
|
|
47
51
|
resendApiKey: process.env.RESEND_API_KEY,
|
|
48
52
|
from: 'billing@acme.com',
|
|
49
53
|
to: 'customer@email.com',
|
|
@@ -76,7 +80,7 @@ await resend.emails.send({
|
|
|
76
80
|
|
|
77
81
|
### `sendPdf(options)`
|
|
78
82
|
|
|
79
|
-
Render a PDF and email it. Returns `
|
|
83
|
+
Render a PDF and email it. Returns Resend's `{ data, error }` shape directly.
|
|
80
84
|
|
|
81
85
|
| Option | Type | Required | Description |
|
|
82
86
|
|--------|------|----------|-------------|
|
package/dist/send-pdf.d.ts
CHANGED
package/dist/send-pdf.js
CHANGED
|
@@ -54,9 +54,5 @@ export async function sendPdf(options) {
|
|
|
54
54
|
emailPayload.tags = tags;
|
|
55
55
|
if (headers)
|
|
56
56
|
emailPayload.headers = headers;
|
|
57
|
-
|
|
58
|
-
if (error) {
|
|
59
|
-
throw new Error(`Resend error: ${error.message}`);
|
|
60
|
-
}
|
|
61
|
-
return { id: result.id };
|
|
57
|
+
return resend.emails.send(emailPayload);
|
|
62
58
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@formepdf/resend",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"description": "Render a PDF and email it in one call — Forme + Resend",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"dist"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@formepdf/react": "0.
|
|
16
|
-
"@formepdf/core": "0.
|
|
15
|
+
"@formepdf/react": "0.6.0",
|
|
16
|
+
"@formepdf/core": "0.6.0"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"resend": ">=3.0.0"
|