@spree/docs 0.1.4 → 0.1.6
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/store.yaml +716 -380
- package/dist/developer/admin/admin.md +1 -1
- package/dist/developer/admin/custom-javascript.md +2 -2
- package/dist/developer/sdk/store/account.md +19 -4
- package/dist/developer/sdk/store/cart-checkout.md +12 -2
- package/dist/developer/sdk/store/payments.md +11 -11
- package/dist/developer/security/security_policy.md +1 -1
- package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +2 -2
- package/dist/integrations/sso-mfa-social-login/storefront.md +2 -2
- package/package.json +1 -1
|
@@ -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.
|
|
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/)
|
|
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
|
|
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
|
|
|
@@ -10,6 +10,7 @@ const options = { token: jwtToken };
|
|
|
10
10
|
|
|
11
11
|
// Get profile
|
|
12
12
|
const profile = await client.customer.get(options);
|
|
13
|
+
// profile includes `available_store_credit_total` and `display_available_store_credit_total`
|
|
13
14
|
|
|
14
15
|
// Update profile
|
|
15
16
|
await client.customer.update({
|
|
@@ -38,17 +39,31 @@ await client.customer.addresses.create({
|
|
|
38
39
|
postal_code: '10001',
|
|
39
40
|
country_iso: 'US',
|
|
40
41
|
state_abbr: 'NY',
|
|
42
|
+
is_default_billing: true, // Optional — set as default billing address
|
|
43
|
+
is_default_shipping: true, // Optional — set as default shipping address
|
|
41
44
|
}, options);
|
|
42
45
|
|
|
43
46
|
// Update address
|
|
44
|
-
await client.customer.addresses.update('addr_xxx', {
|
|
47
|
+
await client.customer.addresses.update('addr_xxx', {
|
|
48
|
+
city: 'Brooklyn',
|
|
49
|
+
is_default_billing: true, // Optional — set as default billing address
|
|
50
|
+
is_default_shipping: false, // Optional — set as default shipping address
|
|
51
|
+
}, options);
|
|
45
52
|
|
|
46
53
|
// Delete address
|
|
47
54
|
await client.customer.addresses.delete('addr_xxx', options);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Store Credits
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
const options = { token: jwtToken };
|
|
61
|
+
|
|
62
|
+
// List store credits
|
|
63
|
+
const { data: credits } = await client.customer.storeCredits.list({}, options);
|
|
48
64
|
|
|
49
|
-
//
|
|
50
|
-
await client.customer.
|
|
51
|
-
await client.customer.addresses.markAsDefault('addr_xxx', 'shipping', options);
|
|
65
|
+
// Get a specific store credit
|
|
66
|
+
const credit = await client.customer.storeCredits.get('sc_xxx', options);
|
|
52
67
|
```
|
|
53
68
|
|
|
54
69
|
## Credit Cards
|
|
@@ -96,11 +96,14 @@ await client.carts.complete(cartId, { spreeToken: cart.token });
|
|
|
96
96
|
|
|
97
97
|
### Fulfillments
|
|
98
98
|
|
|
99
|
+
Fulfillments are included in the cart response — there is no separate list endpoint.
|
|
100
|
+
|
|
99
101
|
```typescript
|
|
100
102
|
const options = { spreeToken: cart.token };
|
|
101
103
|
|
|
102
|
-
//
|
|
103
|
-
const
|
|
104
|
+
// Access fulfillments from the cart response
|
|
105
|
+
const cart = await client.carts.get(cartId, options);
|
|
106
|
+
const fulfillments = cart.fulfillments;
|
|
104
107
|
|
|
105
108
|
// Select a delivery rate
|
|
106
109
|
await client.carts.fulfillments.update(cartId, fulfillmentId, {
|
|
@@ -123,6 +126,13 @@ await client.carts.storeCredits.apply(cartId, 25.00, options);
|
|
|
123
126
|
await client.carts.storeCredits.remove(cartId, options);
|
|
124
127
|
```
|
|
125
128
|
|
|
129
|
+
The cart/order response includes store credit and gift card totals:
|
|
130
|
+
|
|
131
|
+
- `store_credit_total` / `display_store_credit_total` — total store credit applied
|
|
132
|
+
- `gift_card_total` / `display_gift_card_total` — total gift card value applied
|
|
133
|
+
- `covered_by_store_credit` — boolean, whether the order is fully covered by store credit
|
|
134
|
+
- `gift_card` — associated gift card (if applicable)
|
|
135
|
+
|
|
126
136
|
## Orders
|
|
127
137
|
|
|
128
138
|
### Get a Completed Order
|
|
@@ -7,13 +7,18 @@ All payment and delivery endpoints require a `cartId` as the first argument.
|
|
|
7
7
|
|
|
8
8
|
## Payment Methods
|
|
9
9
|
|
|
10
|
+
Payment methods, payments, and fulfillments are included in the cart response -- there are no separate list or get endpoints for these resources.
|
|
11
|
+
|
|
10
12
|
```typescript
|
|
11
13
|
const options = { spreeToken: cart.token };
|
|
12
14
|
|
|
13
|
-
//
|
|
14
|
-
const
|
|
15
|
+
// Access payment methods, payments, and fulfillments from the cart response
|
|
16
|
+
const cart = await client.carts.get(cartId, options);
|
|
17
|
+
const paymentMethods = cart.payment_methods;
|
|
18
|
+
const payments = cart.payments;
|
|
19
|
+
const fulfillments = cart.fulfillments;
|
|
15
20
|
|
|
16
|
-
// Each method includes a `session_required` flag:
|
|
21
|
+
// Each payment method includes a `session_required` flag:
|
|
17
22
|
// - true → use Payment Sessions (Stripe, Adyen, PayPal, etc.)
|
|
18
23
|
// - false → use direct payment creation (Check, Cash on Delivery, Bank Transfer, etc.)
|
|
19
24
|
```
|
|
@@ -23,12 +28,6 @@ const methods = await client.carts.paymentMethods.list(cartId, options);
|
|
|
23
28
|
```typescript
|
|
24
29
|
const options = { spreeToken: cart.token };
|
|
25
30
|
|
|
26
|
-
// List payments on the current cart
|
|
27
|
-
const payments = await client.carts.payments.list(cartId, options);
|
|
28
|
-
|
|
29
|
-
// Get a specific payment
|
|
30
|
-
const payment = await client.carts.payments.get(cartId, paymentId, options);
|
|
31
|
-
|
|
32
31
|
// Create a payment for a non-session payment method
|
|
33
32
|
// (e.g. Check, Cash on Delivery, Bank Transfer, Purchase Order)
|
|
34
33
|
const payment = await client.carts.payments.create(cartId, {
|
|
@@ -86,8 +85,9 @@ console.log(completed.status); // 'completed'
|
|
|
86
85
|
```typescript
|
|
87
86
|
const options = { spreeToken: cart.token };
|
|
88
87
|
|
|
89
|
-
//
|
|
90
|
-
const
|
|
88
|
+
// Fulfillments are included in the cart response
|
|
89
|
+
const cart = await client.carts.get(cartId, options);
|
|
90
|
+
const fulfillments = cart.fulfillments;
|
|
91
91
|
|
|
92
92
|
// Select a delivery rate
|
|
93
93
|
await client.carts.fulfillments.update(cartId, fulfillmentId, {
|
|
@@ -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
|
|
42
|
-
- Compatibility matters. Integration strategies can differ depending on whether you’re on the latest Spree release
|
|
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
|
|
43
|
-
- Ensure compatibility with your Spree
|
|
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)
|