Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix: escape scope notes in the Admin API endpoints page and use Spree 6 event names in email docs (#14704)

Damian Legawiecb7b8379ff397
diff --git a/docs/api-reference/admin-api/endpoints.mdx b/docs/api-reference/admin-api/endpoints.mdx
index 6f0369f0fc..760573e697 100644
--- a/docs/api-reference/admin-api/endpoints.mdx
+++ b/docs/api-reference/admin-api/endpoints.mdx
@@ -711,7 +711,7 @@ Endpoints marked — are exempt from scope checks (authentication and session en
| Method | Path | Required scope | Summary |
|---|---|---|---|
| `GET` | `/translations` | `read_products` | Translation coverage for a resource type |
-| `POST` | `/translations/batch` | *write_<resource> for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
+| `POST` | `/translations/batch` | *write_&lt;resource&gt; for every resource type in the batch (for API-key authentication)* | Batch upsert translations |
## Webhook endpoints
diff --git a/docs/developer/deployment/emails.mdx b/docs/developer/deployment/emails.mdx
index 29fdd2315f..b6cf4625a7 100644
--- a/docs/developer/deployment/emails.mdx
+++ b/docs/developer/deployment/emails.mdx
@@ -30,7 +30,7 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks:
- **URL:** `https://your-storefront.com/api/webhooks/spree`
- - **Events:** `order.completed`, `order.canceled`, `order.shipped`, `customer.password_reset_requested`, `newsletter_subscriber.subscription_requested`
+ - **Events:** `order.placed`, `order.canceled`, `order.fulfilled`, `customer.password_reset_requested`
2. **Configure the storefront** with the webhook secret and email provider:
@@ -49,14 +49,13 @@ Spree Backend → Webhook POST → Storefront → render email → send via Rese
| Event | Email |
|-------|-------|
-| `order.completed` | Order confirmation with items, totals, addresses |
+| `order.placed` | Order confirmation with items, totals, addresses |
| `order.canceled` | Cancellation notice |
-| `order.shipped` | Shipping notification with tracking link |
+| `order.fulfilled` | Shipping notification with tracking link |
| `customer.password_reset_requested` | Password reset link |
-| `newsletter_subscriber.subscription_requested` | Newsletter double opt-in confirmation link |
<Note>
- The storefront listens for `order.completed` and `order.shipped`, the names these events had before Spree 6.0. Spree 6.0 still sends them alongside the new names, `order.placed` and `order.fulfilled`, but stops in Spree 6.1. Before upgrading to 6.1, switch the storefront handlers and your webhook endpoint subscriptions to the new names.
+ 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.
</Note>
#### Custom Frameworks
diff --git a/docs/developer/storefront/nextjs/emails.mdx b/docs/developer/storefront/nextjs/emails.mdx
index c44414fd2c..5e6a720356 100644
--- a/docs/developer/storefront/nextjs/emails.mdx
+++ b/docs/developer/storefront/nextjs/emails.mdx
@@ -16,15 +16,15 @@ Email templates are React components in `src/lib/emails/`:
| File | Event | Description |
|------|-------|-------------|
-| `order-confirmation.tsx` | `order.completed` | Items, totals, addresses, delivery method |
+| `order-confirmation.tsx` | `order.placed` | Items, totals, addresses, delivery method |
| `order-canceled.tsx` | `order.canceled` | Cancellation notice with items |
-| `shipment-shipped.tsx` | `order.shipped` | Tracking number and link |
+| `shipment-shipped.tsx` | `order.fulfilled` | Tracking number and link |
| `password-reset.tsx` | `customer.password_reset_requested` | Reset button and fallback link |
Customize a template by editing its file directly — they use `@react-email/components` for email-safe layout primitives.
<Note>
- The storefront listens for `order.completed` and `order.shipped`, the names these events had before Spree 6.0. Spree 6.0 still sends them alongside the new names, `order.placed` and `order.fulfilled`, but stops in Spree 6.1. Before upgrading to 6.1, switch the storefront handlers and your webhook endpoint subscriptions to the new names.
+ 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.
</Note>
## Previewing
@@ -59,9 +59,9 @@ import { createWebhookHandler } from '@/lib/spree/webhooks'
const handler = createWebhookHandler({
secret: process.env.SPREE_WEBHOOK_SECRET!,
handlers: {
- 'order.completed': handleOrderCompleted,
+ 'order.placed': handleOrderPlaced,
'order.canceled': handleOrderCanceled,
- 'order.shipped': handleOrderShipped,
+ 'order.fulfilled': handleOrderFulfilled,
'customer.password_reset_requested': handlePasswordReset,
},
})
@@ -76,7 +76,7 @@ To add a new email type:
## Setup
-1. **Create a webhook endpoint** in Spree Admin → Settings → Developer → Webhooks. Subscribe to `order.completed`, `order.canceled`, `order.shipped`, and `customer.password_reset_requested`, and copy the secret key into `SPREE_WEBHOOK_SECRET`.
+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`.
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/):
diff --git a/packages/cli/scripts/generate-endpoints-doc.mjs b/packages/cli/scripts/generate-endpoints-doc.mjs
index 81e43df7ff..bbaa8b420f 100644
--- a/packages/cli/scripts/generate-endpoints-doc.mjs
+++ b/packages/cli/scripts/generate-endpoints-doc.mjs
@@ -33,7 +33,13 @@ function requiredScope(operation) {
const token = raw.match(/^`([a-z_]+)`$/)
if (token) return `\`${token[1]}\``
// Free-form note (e.g. exports resolve their scope per type) — keep it short.
- return `*${raw.replaceAll('`', '').split(' — ')[0]}*`
+ // Escape angle brackets — the page is MDX, where `<resource>` parses as a JSX tag.
+ const note = raw
+ .replaceAll('`', '')
+ .split(' — ')[0]
+ .replaceAll('<', '&lt;')
+ .replaceAll('>', '&gt;')
+ return `*${note}*`
}
const groups = new Map()