@spree/docs 0.1.247 → 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.
Files changed (76) hide show
  1. package/dist/api-reference/admin-api/authentication.md +34 -14
  2. package/dist/api-reference/admin-api/endpoints.md +366 -14
  3. package/dist/api-reference/admin-api/errors.md +2 -2
  4. package/dist/api-reference/admin-api/introduction.md +3 -3
  5. package/dist/api-reference/admin-api/querying.md +6 -6
  6. package/dist/api-reference/store-api/monetary-amounts.md +5 -5
  7. package/dist/api-reference/webhooks-events.md +330 -335
  8. package/dist/developer/agentic/agent-skills.md +5 -2
  9. package/dist/developer/agentic/llm-docs.md +2 -1
  10. package/dist/developer/cli/admin-api.md +1 -1
  11. package/dist/developer/cli/quickstart.md +2 -2
  12. package/dist/developer/contributing/creating-an-extension.md +292 -146
  13. package/dist/developer/contributing/developing-spree.md +13 -17
  14. package/dist/developer/core-concepts/catalogs.md +2 -2
  15. package/dist/developer/core-concepts/channels.md +3 -3
  16. package/dist/developer/core-concepts/companies.md +2 -1
  17. package/dist/developer/core-concepts/delivery-setup.md +2 -2
  18. package/dist/developer/core-concepts/discounts.md +3 -3
  19. package/dist/developer/core-concepts/events.md +6 -5
  20. package/dist/developer/core-concepts/freight.md +3 -2
  21. package/dist/developer/core-concepts/fulfillments.md +10 -8
  22. package/dist/developer/core-concepts/imports-exports.md +11 -8
  23. package/dist/developer/core-concepts/inventory.md +2 -2
  24. package/dist/developer/core-concepts/media.md +14 -14
  25. package/dist/developer/core-concepts/orders.md +2 -2
  26. package/dist/developer/core-concepts/payments.md +1 -2
  27. package/dist/developer/core-concepts/products.md +6 -6
  28. package/dist/developer/core-concepts/reporting.md +4 -3
  29. package/dist/developer/core-concepts/returns-exchanges-claims.md +7 -7
  30. package/dist/developer/core-concepts/search-filtering.md +3 -3
  31. package/dist/developer/core-concepts/sellers.md +22 -3
  32. package/dist/developer/core-concepts/staff-roles.md +4 -2
  33. package/dist/developer/core-concepts/store-credits-gift-cards.md +1 -1
  34. package/dist/developer/core-concepts/stores.md +2 -2
  35. package/dist/developer/core-concepts/translations.md +12 -8
  36. package/dist/developer/core-concepts/webhooks.md +19 -18
  37. package/dist/developer/create-spree-app/quickstart.md +2 -7
  38. package/dist/developer/customization/api.md +1 -1
  39. package/dist/developer/customization/checkout.md +2 -2
  40. package/dist/developer/customization/dependencies.md +53 -37
  41. package/dist/developer/customization/permissions.md +2 -2
  42. package/dist/developer/dashboard/concepts.md +1 -1
  43. package/dist/developer/dashboard/customization/navigation.md +3 -2
  44. package/dist/developer/dashboard/customization/permissions.md +6 -6
  45. package/dist/developer/dashboard/plugins/publishing.md +4 -4
  46. package/dist/developer/dashboard/plugins/scaffolding.md +1 -1
  47. package/dist/developer/dashboard/public-api.md +1 -1
  48. package/dist/developer/dashboard/recipes/attribute-end-to-end.md +3 -18
  49. package/dist/developer/deployment/aws.md +1 -1
  50. package/dist/developer/deployment/aws_ecs.md +3 -3
  51. package/dist/developer/deployment/background_jobs.md +9 -3
  52. package/dist/developer/deployment/docker.md +1 -2
  53. package/dist/developer/deployment/emails.md +3 -1
  54. package/dist/developer/deployment/environment_variables.md +2 -2
  55. package/dist/developer/deployment/render.md +2 -2
  56. package/dist/developer/how-to/build-a-marketplace.md +2 -2
  57. package/dist/developer/how-to/custom-api-authentication.md +1 -1
  58. package/dist/developer/how-to/custom-delivery-rate-provider.md +11 -3
  59. package/dist/developer/how-to/custom-document-numbers.md +1 -1
  60. package/dist/developer/how-to/custom-order-routing.md +15 -14
  61. package/dist/developer/how-to/custom-payment-method.md +17 -19
  62. package/dist/developer/how-to/custom-promotion.md +4 -4
  63. package/dist/developer/how-to/custom-search-provider.md +12 -5
  64. package/dist/developer/how-to/custom-stock-splitter.md +25 -24
  65. package/dist/developer/how-to/sell-digital-products.md +1 -1
  66. package/dist/developer/multi-tenant/quickstart.md +2 -2
  67. package/dist/developer/providers/payouts.md +6 -2
  68. package/dist/developer/sdk/admin/querying-and-errors.md +1 -1
  69. package/dist/developer/sdk/admin/quickstart.md +4 -4
  70. package/dist/developer/sdk/authentication.md +5 -2
  71. package/dist/developer/sdk/store/cart-checkout.md +4 -4
  72. package/dist/developer/storefront/nextjs/emails.md +4 -2
  73. package/dist/developer/storefront/nextjs/testing.md +1 -1
  74. package/dist/developer/upgrades/5.6-to-6.0.md +51 -20
  75. package/dist/integrations/search/meilisearch.md +4 -4
  76. 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 1 hour by default. Refresh them with the current token:
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
- const { token } = await client.auth.refresh({ token: currentToken })
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
- -H 'X-Spree-Api-Key: sk_xxx' \
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/*`, `/media/*`, `/prices/*`, `/price_lists/*` |
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/*`, `/stock_items/*`, `/stock_transfers/*`, `/stock_reservations/*` |
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
- | `read_settings` / `write_settings` | Store configuration — `/store`, `/payment_methods/*`, `/markets/*`, `/channels/*`, `/tax_categories/*`, `/countries`, `/custom_field_definitions/*`, staff management (`/admin_users`, `/invitations`, `/roles`), `/allowed_origins/*` |
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: CanCanCan abilities
172
+ ### JWT bearer tokens: role permissions
158
173
 
159
- JWT-authenticated admin users are authorized via [CanCanCan](https://github.com/CanCanCommunity/cancancan) abilities derived from their `Spree::Role`s. The SPA uses this fine-grained model to render UI conditionally; partial-permission staff users see only the resources their role grants.
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 caller lacks permission for a specific action, the API returns `403 Forbidden`:
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": "You are not authorized to perform this action"
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 | CanCanCan abilities |
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: CanCanCan applies and scopes are ignored. This lets you use `sk_xxx` to bootstrap a session and then issue per-user JWTs for individual admin actions.
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.retrieve('or_m3Rp9wXz', { expand: ['canceler'] })
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
  ```