@spree/docs 0.1.5 → 0.1.7

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.
@@ -4,7 +4,7 @@ sidebarTitle: Overview
4
4
  description: Learn how to customize and extend the Spree Admin Dashboard
5
5
  ---
6
6
 
7
- The Spree Admin Dashboard is a full-featured administration interface for managing your e-commerce store. It's built with Ruby on Rails and ships as the `spree_admin` gem.
7
+ The Spree Admin Dashboard is a full-featured administration interface for managing your e-commerce store.
8
8
 
9
9
  <img src="/images/spree_admin_dashboard.png" alt="Spree Admin Dashboard" />
10
10
 
@@ -6,7 +6,7 @@ description: Learn how to add custom JavaScript to your Spree Admin Dashboard
6
6
 
7
7
  ## Extending Admin Dashboard with JavaScript
8
8
 
9
- Spree Admin Dashboard can be easily extended with custom JavaScript. Most of the JavaScript in the Admin Dashboard is powered by a framework called [Stimulus.js](https://stimulus.hotwired.dev/) which is the Ruby on Rails default. It's a very simple and minimalistic framework only enhancing our server-side rendered HTML with a bit of interactivity.
9
+ Spree Admin Dashboard can be easily extended with custom JavaScript. Most of the JavaScript in the Admin Dashboard is powered by a framework called [Stimulus.js](https://stimulus.hotwired.dev/). It's a very simple and minimalistic framework only enhancing our server-side rendered HTML with a bit of interactivity.
10
10
 
11
11
  ### 3rd party JavaScript libraries
12
12
 
@@ -29,7 +29,7 @@ You're probably wondering why these libraries are in the `vendor` directory, and
29
29
 
30
30
  That's because we're not using Node.js at all. So no Yarn or npm. We're using a different approach to manage dependencies.
31
31
 
32
- We're using a tool called [Importmaps](https://github.com/rails/importmap-rails) to manage dependencies which is the Ruby on Rails default.
32
+ We're using a tool called [Importmaps](https://github.com/rails/importmap-rails) to manage dependencies.
33
33
 
34
34
  > **INFO:** If you want to use a different JavaScript package manager you can do so by using [jsbundling-rails](https://github.com/rails/jsbundling-rails) gem.
35
35
 
@@ -155,6 +155,81 @@ Price Lists are managed in the Admin Panel under **Products → Price Lists**, o
155
155
 
156
156
  Each Price List contains prices for specific variants and currencies. Products can be added to a Price List, and individual variant prices set within it.
157
157
 
158
+ ## Price History (EU Omnibus Directive)
159
+
160
+ Spree automatically records price changes for EU Omnibus Directive compliance. When a product goes on sale, EU regulations require displaying the lowest price in the preceding 30 days alongside the discounted price.
161
+
162
+ ### How It Works
163
+
164
+ Every time a base price amount changes, a `PriceHistory` record is created automatically. Price list prices are not tracked — only the base price visible to all customers.
165
+
166
+ ### Fetching Prior Price via API
167
+
168
+ The prior price is available as an expandable field on product and variant endpoints:
169
+
170
+
171
+ ```typescript SDK
172
+ const product = await client.products.get('spree-tote', {
173
+ expand: ['prior_price'],
174
+ })
175
+
176
+ if (product.prior_price) {
177
+ console.log(product.prior_price.amount) // "9.99"
178
+ console.log(product.prior_price.display_amount) // "$9.99"
179
+ console.log(product.prior_price.currency) // "USD"
180
+ console.log(product.prior_price.recorded_at) // "2026-03-10T..."
181
+ }
182
+ ```
183
+
184
+ ```bash cURL
185
+ curl 'https://api.mystore.com/api/v3/store/products/spree-tote?expand=prior_price' \
186
+ -H 'X-Spree-API-Key: spree_pk_xxx'
187
+ ```
188
+
189
+
190
+ The response includes a `prior_price` object when expanded:
191
+
192
+ ```json
193
+ {
194
+ "id": "prod_xxx",
195
+ "name": "Spree Tote",
196
+ "price": { "amount": "15.99", "currency": "USD", "display_amount": "$15.99" },
197
+ "prior_price": {
198
+ "amount": "9.99",
199
+ "amount_in_cents": 999,
200
+ "currency": "USD",
201
+ "display_amount": "$9.99",
202
+ "recorded_at": "2026-03-10T14:30:00Z"
203
+ }
204
+ }
205
+ ```
206
+
207
+ ### Configuration
208
+
209
+ Price history tracking is enabled by default. To disable it (e.g., for non-EU stores):
210
+
211
+ ```ruby
212
+ # config/initializers/spree.rb
213
+ Spree.config do |config|
214
+ config.track_price_history = false
215
+ config.price_history_retention_days = 30 # default
216
+ end
217
+ ```
218
+
219
+ Price history retention defaults to 30 days and can be configured globally. A Rake task is provided for cleanup:
220
+
221
+ ```bash
222
+ bundle exec rake spree:price_history:prune
223
+ ```
224
+
225
+ ### Seeding Existing Prices
226
+
227
+ After enabling price history on an existing store, seed the current prices as a baseline:
228
+
229
+ ```bash
230
+ bundle exec rake spree:price_history:seed
231
+ ```
232
+
158
233
  ## Related Documentation
159
234
 
160
235
  - [Products](products.md) — Products, Variants, and base prices
@@ -84,6 +84,25 @@ const product = await client.products.get('spree-tote', {
84
84
  });
85
85
  ```
86
86
 
87
+ ### Prior Price (EU Omnibus Directive)
88
+
89
+ When a product is on sale, EU regulations require displaying the lowest price in the last 30 days. Use the `prior_price` expand to fetch this:
90
+
91
+ ```typescript
92
+ const product = await client.products.get('spree-tote', {
93
+ expand: ['prior_price'],
94
+ });
95
+
96
+ if (product.prior_price) {
97
+ console.log(product.prior_price.amount); // "9.99"
98
+ console.log(product.prior_price.display_amount); // "$9.99"
99
+ console.log(product.prior_price.currency); // "USD"
100
+ console.log(product.prior_price.recorded_at); // "2026-03-10T..."
101
+ }
102
+ ```
103
+
104
+ > **INFO:** Prior price is only relevant on product detail pages (PDP), not on listings. It returns `null` if no price history exists within the 30-day window. Price history tracking can be disabled globally via `Spree::Config[:track_price_history] = false`.
105
+
87
106
  ### Product Filters
88
107
 
89
108
  Get available filters (price range, availability, options, categories) and sort options for building filter UIs:
@@ -58,7 +58,7 @@ Published security advisories can be found at [GitHub Security Advisories](https
58
58
 
59
59
  ## Security Best Practices
60
60
 
61
- Spree is built on **Ruby on Rails** which provides strong security defaults including protection against SQL injection, CSRF, and XSS. For more details on how Spree handles security in production environments, see the [Enterprise Security Overview](/user/security).
61
+ Spree API is built on **Ruby on Rails** which provides strong security defaults including protection against SQL injection, CSRF, and XSS. For more details on how Spree handles security in production environments, see the [Enterprise Security Overview](/user/security).
62
62
 
63
63
  We recommend:
64
64
 
@@ -38,8 +38,8 @@ Each SSO integration needs to be scoped individually. The integration plan depen
38
38
  - Each provider has unique configuration details, such as OAuth endpoints, certificates, tenant IDs, and federation settings. You’ll need to gather these to complete integration.
39
39
  - **Existing or planned Spree customizations**
40
40
  - Custom authentication flows, extended user models, or unique admin permissions may affect how SSO is integrated. These should be reviewed before implementation.
41
- - **Spree and Ruby on Rails versions**
42
- - Compatibility matters. Integration strategies can differ depending on whether you’re on the latest Spree release and which Rails version your project runs on.
41
+ - **Spree version**
42
+ - Compatibility matters. Integration strategies can differ depending on whether you’re on the latest Spree release.
43
43
  - **Use case: single tenant vs. multi-tenant**
44
44
  - Single-tenant stores usually need straightforward workforce SSO. Multi-tenant or SaaS-style deployments may require isolated tenant directories and more complex provisioning.
45
45
  - **Identity governance requirements** (role-based access, just-in-time provisioning)
@@ -39,8 +39,8 @@ Each storefront integration must be scoped individually. Consider the following:
39
39
  - Decide whether you only want to add social login on top of Spree’s existing authentication or fully replace it with a unified SSO + social login solution.
40
40
  - **Existing or planned Spree customizations**
41
41
  - Customized signup flows, checkout flows, or customer segmentation logic may impact integration design. These need to be factored in during scoping.
42
- - **Spree and Ruby on Rails versions**
43
- - Ensure compatibility with your Spree and Rails versions. Older projects may need adjustments to take advantage of newer identity management features.
42
+ - **Spree version**
43
+ - Ensure compatibility with your Spree version. Older projects may need adjustments to take advantage of newer identity management features.
44
44
  - **Identity governance requirements** (segmentation, customer role-based access)
45
45
  - **User lifecycle management** (account creation, deactivation, syncing)
46
46
  - **Security posture** (MFA for customers, adaptive login, fraud detection)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spree/docs",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Spree Commerce developer documentation for AI agents and local reference",
5
5
  "type": "module",
6
6
  "license": "CC-BY-4.0",