@spree/docs 0.1.253 → 0.1.254
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.
|
@@ -711,7 +711,7 @@ Endpoints marked — are exempt from scope checks (authentication and session en
|
|
|
711
711
|
| Method | Path | Required scope | Summary |
|
|
712
712
|
|---|---|---|---|
|
|
713
713
|
| `GET` | `/translations` | `read_products` | Translation coverage for a resource type |
|
|
714
|
-
| `POST` | `/translations/batch` | *write_
|
|
714
|
+
| `POST` | `/translations/batch` | *write_<resource> for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
|
|
715
715
|
|
|
716
716
|
## Webhook endpoints
|
|
717
717
|
|
|
@@ -30,7 +30,7 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
|
|
|
30
30
|
|
|
31
31
|
1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks:
|
|
32
32
|
- **URL:** `https://your-storefront.com/api/webhooks/spree`
|
|
33
|
-
- **Events:** `order.
|
|
33
|
+
- **Events:** `order.placed`, `order.canceled`, `order.fulfilled`, `customer.password_reset_requested`
|
|
34
34
|
|
|
35
35
|
2. **Configure the storefront** with the webhook secret and email provider:
|
|
36
36
|
|
|
@@ -49,13 +49,12 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
|
|
|
49
49
|
|
|
50
50
|
| Event | Email |
|
|
51
51
|
|-------|-------|
|
|
52
|
-
| `order.
|
|
52
|
+
| `order.placed` | Order confirmation with items, totals, addresses |
|
|
53
53
|
| `order.canceled` | Cancellation notice |
|
|
54
|
-
| `order.
|
|
54
|
+
| `order.fulfilled` | Shipping notification with tracking link |
|
|
55
55
|
| `customer.password_reset_requested` | Password reset link |
|
|
56
|
-
| `newsletter_subscriber.subscription_requested` | Newsletter double opt-in confirmation link |
|
|
57
56
|
|
|
58
|
-
> **NOTE:**
|
|
57
|
+
> **NOTE:** Spree 6.0 also sends the pre-6.0 names `order.completed` and `order.shipped` as deprecated aliases until 6.1. Subscribe the endpoint to the new names only — subscribing to both makes Spree deliver both events.
|
|
59
58
|
|
|
60
59
|
#### Custom Frameworks
|
|
61
60
|
|
|
@@ -16,14 +16,14 @@ Email templates are React components in `src/lib/emails/`:
|
|
|
16
16
|
|
|
17
17
|
| File | Event | Description |
|
|
18
18
|
|------|-------|-------------|
|
|
19
|
-
| `order-confirmation.tsx` | `order.
|
|
19
|
+
| `order-confirmation.tsx` | `order.placed` | Items, totals, addresses, delivery method |
|
|
20
20
|
| `order-canceled.tsx` | `order.canceled` | Cancellation notice with items |
|
|
21
|
-
| `shipment-shipped.tsx` | `order.
|
|
21
|
+
| `shipment-shipped.tsx` | `order.fulfilled` | Tracking number and link |
|
|
22
22
|
| `password-reset.tsx` | `customer.password_reset_requested` | Reset button and fallback link |
|
|
23
23
|
|
|
24
24
|
Customize a template by editing its file directly — they use `@react-email/components` for email-safe layout primitives.
|
|
25
25
|
|
|
26
|
-
> **NOTE:**
|
|
26
|
+
> **NOTE:** Spree 6.0 also sends the pre-6.0 names `order.completed` and `order.shipped` as deprecated aliases until 6.1. Subscribe the endpoint to the new names only — subscribing to both makes Spree deliver both events.
|
|
27
27
|
|
|
28
28
|
## Previewing
|
|
29
29
|
|
|
@@ -57,9 +57,9 @@ import { createWebhookHandler } from '@/lib/spree/webhooks'
|
|
|
57
57
|
const handler = createWebhookHandler({
|
|
58
58
|
secret: process.env.SPREE_WEBHOOK_SECRET!,
|
|
59
59
|
handlers: {
|
|
60
|
-
'order.
|
|
60
|
+
'order.placed': handleOrderPlaced,
|
|
61
61
|
'order.canceled': handleOrderCanceled,
|
|
62
|
-
'order.
|
|
62
|
+
'order.fulfilled': handleOrderFulfilled,
|
|
63
63
|
'customer.password_reset_requested': handlePasswordReset,
|
|
64
64
|
},
|
|
65
65
|
})
|
|
@@ -74,7 +74,7 @@ To add a new email type:
|
|
|
74
74
|
|
|
75
75
|
## Setup
|
|
76
76
|
|
|
77
|
-
1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks. Subscribe to `order.
|
|
77
|
+
1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks. Subscribe to `order.placed`, `order.canceled`, `order.fulfilled`, and `customer.password_reset_requested`, and copy the secret key into `SPREE_WEBHOOK_SECRET`.
|
|
78
78
|
|
|
79
79
|
2. **Receive webhooks locally.** Expose the storefront with a public URL so Spree can reach it — the simplest option is a [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/):
|
|
80
80
|
|