@spree/docs 0.1.248 → 0.1.249
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/dist/api-reference/admin-api/authentication.md +34 -14
- package/dist/api-reference/admin-api/endpoints.md +366 -14
- package/dist/api-reference/admin-api/errors.md +2 -2
- package/dist/api-reference/admin-api/introduction.md +3 -3
- package/dist/api-reference/admin-api/querying.md +6 -6
- package/dist/api-reference/store-api/monetary-amounts.md +5 -5
- package/dist/api-reference/webhooks-events.md +330 -335
- package/dist/developer/agentic/agent-skills.md +5 -2
- package/dist/developer/agentic/llm-docs.md +2 -1
- package/dist/developer/cli/admin-api.md +1 -1
- package/dist/developer/cli/quickstart.md +2 -2
- package/dist/developer/contributing/creating-an-extension.md +292 -146
- package/dist/developer/contributing/developing-spree.md +13 -17
- package/dist/developer/core-concepts/catalogs.md +2 -2
- package/dist/developer/core-concepts/channels.md +3 -3
- package/dist/developer/core-concepts/companies.md +2 -1
- package/dist/developer/core-concepts/delivery-setup.md +2 -2
- package/dist/developer/core-concepts/discounts.md +3 -3
- package/dist/developer/core-concepts/events.md +6 -5
- package/dist/developer/core-concepts/freight.md +3 -2
- package/dist/developer/core-concepts/fulfillments.md +10 -8
- package/dist/developer/core-concepts/imports-exports.md +11 -8
- package/dist/developer/core-concepts/inventory.md +2 -2
- package/dist/developer/core-concepts/media.md +14 -14
- package/dist/developer/core-concepts/orders.md +2 -2
- package/dist/developer/core-concepts/payments.md +1 -2
- package/dist/developer/core-concepts/products.md +6 -6
- package/dist/developer/core-concepts/reporting.md +4 -3
- package/dist/developer/core-concepts/returns-exchanges-claims.md +7 -7
- package/dist/developer/core-concepts/search-filtering.md +3 -3
- package/dist/developer/core-concepts/sellers.md +3 -3
- package/dist/developer/core-concepts/staff-roles.md +4 -2
- package/dist/developer/core-concepts/store-credits-gift-cards.md +1 -1
- package/dist/developer/core-concepts/stores.md +2 -2
- package/dist/developer/core-concepts/translations.md +12 -8
- package/dist/developer/core-concepts/webhooks.md +19 -18
- package/dist/developer/create-spree-app/quickstart.md +2 -7
- package/dist/developer/customization/api.md +1 -1
- package/dist/developer/customization/checkout.md +2 -2
- package/dist/developer/customization/dependencies.md +53 -37
- package/dist/developer/customization/permissions.md +2 -2
- package/dist/developer/dashboard/concepts.md +1 -1
- package/dist/developer/dashboard/customization/navigation.md +3 -2
- package/dist/developer/dashboard/customization/permissions.md +6 -6
- package/dist/developer/dashboard/plugins/publishing.md +4 -4
- package/dist/developer/dashboard/plugins/scaffolding.md +1 -1
- package/dist/developer/dashboard/public-api.md +1 -1
- package/dist/developer/dashboard/recipes/attribute-end-to-end.md +3 -18
- package/dist/developer/deployment/aws.md +1 -1
- package/dist/developer/deployment/aws_ecs.md +3 -3
- package/dist/developer/deployment/background_jobs.md +9 -3
- package/dist/developer/deployment/docker.md +1 -2
- package/dist/developer/deployment/emails.md +3 -1
- package/dist/developer/deployment/environment_variables.md +2 -2
- package/dist/developer/deployment/render.md +2 -2
- package/dist/developer/how-to/build-a-marketplace.md +2 -2
- package/dist/developer/how-to/custom-api-authentication.md +1 -1
- package/dist/developer/how-to/custom-delivery-rate-provider.md +11 -3
- package/dist/developer/how-to/custom-document-numbers.md +1 -1
- package/dist/developer/how-to/custom-order-routing.md +15 -14
- package/dist/developer/how-to/custom-payment-method.md +17 -19
- package/dist/developer/how-to/custom-promotion.md +4 -4
- package/dist/developer/how-to/custom-search-provider.md +12 -5
- package/dist/developer/how-to/custom-stock-splitter.md +25 -24
- package/dist/developer/how-to/sell-digital-products.md +1 -1
- package/dist/developer/multi-tenant/quickstart.md +2 -2
- package/dist/developer/providers/payouts.md +6 -2
- package/dist/developer/sdk/admin/querying-and-errors.md +1 -1
- package/dist/developer/sdk/admin/quickstart.md +4 -4
- package/dist/developer/sdk/authentication.md +5 -2
- package/dist/developer/sdk/store/cart-checkout.md +4 -4
- package/dist/developer/storefront/nextjs/emails.md +4 -2
- package/dist/developer/storefront/nextjs/testing.md +1 -1
- package/dist/developer/upgrades/5.6-to-6.0.md +51 -20
- package/dist/integrations/search/meilisearch.md +4 -4
- package/package.json +1 -1
|
@@ -84,17 +84,19 @@ curl -X POST 'https://store.example.com/api/v3/admin/auth/login' \
|
|
|
84
84
|
|
|
85
85
|
### Token refresh
|
|
86
86
|
|
|
87
|
-
JWT tokens expire after
|
|
87
|
+
Admin JWT tokens are short-lived — they expire after 5 minutes by default (configurable with `SPREE_ADMIN_JWT_EXPIRATION`, in seconds). Login also sets a refresh token in an HttpOnly cookie scoped to `/api/v3/admin/auth`; it is never returned in the response body. Exchange that cookie for a new access token:
|
|
88
88
|
|
|
89
89
|
|
|
90
90
|
```typescript SDK
|
|
91
|
-
|
|
91
|
+
// Sends the refresh cookie set at login; the cookie is rotated on every call
|
|
92
|
+
const { token } = await client.auth.refresh()
|
|
93
|
+
client.setToken(token)
|
|
92
94
|
```
|
|
93
95
|
|
|
94
96
|
```bash cURL
|
|
97
|
+
# Log in with -c cookies.txt to store the refresh cookie, then:
|
|
95
98
|
curl -X POST 'https://store.example.com/api/v3/admin/auth/refresh' \
|
|
96
|
-
-
|
|
97
|
-
-H 'Authorization: Bearer <current_jwt_token>'
|
|
99
|
+
-b cookies.txt -c cookies.txt
|
|
98
100
|
```
|
|
99
101
|
|
|
100
102
|
|
|
@@ -109,7 +111,10 @@ Each secret API key carries a list of **scopes** that grant access to specific r
|
|
|
109
111
|
| Scope | Grants access to |
|
|
110
112
|
|---|---|
|
|
111
113
|
| `read_orders` / `write_orders` | `/orders/*` — including nested items and adjustments |
|
|
112
|
-
| `read_products` / `write_products` | `/products/*`, `/variants/*`, `/option_types/*`, `/
|
|
114
|
+
| `read_products` / `write_products` | `/products/*`, `/variants/*`, `/option_types/*`, `/prices/*`, `/price_lists/*`, `/catalogs/*`, `/digital_assets/*`, `/imports/*` |
|
|
115
|
+
| `read_product_types` / `write_product_types` | `/product_types/*` |
|
|
116
|
+
| `read_publishing` / `write_publishing` | Publishing products to channels |
|
|
117
|
+
| `read_media` / `write_media` | `/media/*` |
|
|
113
118
|
| `read_promotions` / `write_promotions` | `/promotions/*` — including nested rules, actions, and coupon codes |
|
|
114
119
|
| `read_customers` / `write_customers` | `/customers/*`, `/customer_groups/*` — including nested addresses and credit cards |
|
|
115
120
|
| `read_payments` / `write_payments` | `/orders/:id/payments` — including capture and void |
|
|
@@ -117,12 +122,22 @@ Each secret API key carries a list of **scopes** that grant access to specific r
|
|
|
117
122
|
| `read_refunds` / `write_refunds` | `/orders/:id/refunds` |
|
|
118
123
|
| `read_gift_cards` / `write_gift_cards` | `/gift_cards/*`, `/gift_card_batches/*`, `/orders/:id/gift_cards` |
|
|
119
124
|
| `read_store_credits` / `write_store_credits` | `/customers/:id/store_credits`, `/orders/:id/store_credits` |
|
|
120
|
-
| `read_stock` / `write_stock` | `/stock_locations/*`, `/
|
|
125
|
+
| `read_stock` / `write_stock` | `/stock_locations/*`, `/stock_levels/*`, `/stock_movements/*`, `/stock_transfers/*`, `/stock_reservations/*`, `/stock_receipts/*` |
|
|
126
|
+
| `read_purchasing` / `write_purchasing` | `/suppliers/*`, `/purchase_orders/*`, `/stock_receipts/*` |
|
|
121
127
|
| `read_categories` / `write_categories` | `/categories/*` |
|
|
122
|
-
| `
|
|
128
|
+
| `read_collections` / `write_collections` | `/collections/*` |
|
|
129
|
+
| `read_sellers` / `write_sellers` | `/sellers/*`, `/seller_requirements/*` |
|
|
130
|
+
| `read_commissions` / `write_commissions` | `/commission_rates/*`, `/commission_lines/*` |
|
|
131
|
+
| `read_payouts` / `write_payouts` | `/seller_transfers/*`, `/seller_payouts/*` |
|
|
132
|
+
| `read_settings` / `write_settings` | Store configuration — `/store`, `/payment_methods/*`, `/markets/*`, `/channels/*`, `/tax_categories/*`, `/custom_field_definitions/*`, `/allowed_origins/*` |
|
|
133
|
+
| `read_staff` / `write_staff` | Staff management — `/admin_users/*`, `/invitations/*`, `/roles/*` |
|
|
134
|
+
| `read_delivery_methods` / `write_delivery_methods` | `/delivery_methods/*` — including rules and carrier services |
|
|
135
|
+
| `read_package_types` / `write_package_types` | `/package_types/*` |
|
|
136
|
+
| `read_integrations` / `write_integrations` | `/integrations/*` |
|
|
123
137
|
| `read_webhooks` / `write_webhooks` | `/webhook_endpoints/*` — including delivery logs and redelivery |
|
|
124
138
|
| `read_api_keys` / `write_api_keys` | `/api_keys/*` — creating, revoking, and deleting API keys |
|
|
125
139
|
| `read_dashboard` | `/dashboard/*` (analytics; read-only) |
|
|
140
|
+
| `read_reports` / `write_reports` | Reports, `/saved_reports/*` and report exports |
|
|
126
141
|
|
|
127
142
|
Custom field **values** are gated by the resource they're attached to: a `write_products` key can manage custom fields on products, variants, and option types; `write_orders` covers order custom fields, and so on. Custom field **definitions** (the schema) are part of `settings`.
|
|
128
143
|
|
|
@@ -154,29 +169,34 @@ If the key lacks the required scope, the API returns `403 Forbidden`:
|
|
|
154
169
|
|
|
155
170
|
The `details.required_scope` field tells you exactly which scope to add — and `spree api-key create --type secret --scopes <scope>` mints a key that has it. Choose the narrowest set that covers your integration's needs.
|
|
156
171
|
|
|
157
|
-
### JWT bearer tokens:
|
|
172
|
+
### JWT bearer tokens: role permissions
|
|
158
173
|
|
|
159
|
-
JWT-authenticated admin users
|
|
174
|
+
JWT-authenticated admin users pass the same per-controller gate as secret keys. Instead of key scopes, the gate checks the permission keys held by the user's `Spree::Role`s on the current store — the same `read_<resource>` / `write_<resource>` vocabulary. The SPA reads those keys from `GET /api/v3/admin/me` to render UI conditionally; partial-permission staff users see only the resources their role grants.
|
|
160
175
|
|
|
161
|
-
If the
|
|
176
|
+
If the user's role lacks the required key, the API returns `403 Forbidden`:
|
|
162
177
|
|
|
163
178
|
```json
|
|
164
179
|
{
|
|
165
180
|
"error": {
|
|
166
181
|
"code": "access_denied",
|
|
167
|
-
"message": "
|
|
182
|
+
"message": "Missing permission: write_orders",
|
|
183
|
+
"details": {
|
|
184
|
+
"required_permission": "write_orders"
|
|
185
|
+
}
|
|
168
186
|
}
|
|
169
187
|
}
|
|
170
188
|
```
|
|
171
189
|
|
|
190
|
+
A `403` without `details.required_permission` means the user holds the key but a record-level rule refused the action.
|
|
191
|
+
|
|
172
192
|
## Authentication summary
|
|
173
193
|
|
|
174
194
|
| Method | Header | Use case | Authorization |
|
|
175
195
|
|---|---|---|---|
|
|
176
196
|
| Secret API key | `X-Spree-Api-Key: sk_xxx` | Server-to-server integrations | Scopes |
|
|
177
|
-
| JWT token | `Authorization: Bearer <token>` | Interactive admin sessions; SPA |
|
|
197
|
+
| JWT token | `Authorization: Bearer <token>` | Interactive admin sessions; SPA | Role permissions |
|
|
178
198
|
|
|
179
|
-
> **NOTE:** If both headers are present, the JWT token wins:
|
|
199
|
+
> **NOTE:** If both headers are present, the JWT token wins: the user's role permissions apply and the key's scopes are ignored. This lets you use `sk_xxx` to bootstrap a session and then issue per-user JWTs for individual admin actions.
|
|
180
200
|
|
|
181
201
|
## Who a write is attributed to
|
|
182
202
|
|
|
@@ -206,7 +226,7 @@ Expanding the association gives the same three facts in one object — `id`,
|
|
|
206
226
|
**SDK:**
|
|
207
227
|
|
|
208
228
|
```ts
|
|
209
|
-
const order = await client.orders.
|
|
229
|
+
const order = await client.orders.get('or_m3Rp9wXz', { expand: ['canceler'] })
|
|
210
230
|
|
|
211
231
|
order.canceler // { id: 'key_8QrN3xLq', type: 'api_key', label: 'WMS connector' }
|
|
212
232
|
```
|