@spree/docs 0.1.177 → 0.1.178

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 (117) hide show
  1. package/dist/developer/cli/quickstart.md +1 -1
  2. package/dist/developer/contributing/creating-an-extension.md +2 -2
  3. package/dist/developer/core-concepts/addresses.md +3 -3
  4. package/dist/developer/core-concepts/architecture.md +4 -4
  5. package/dist/developer/core-concepts/calculators.md +2 -2
  6. package/dist/developer/core-concepts/carts.md +207 -0
  7. package/dist/developer/core-concepts/channels.md +3 -3
  8. package/dist/developer/core-concepts/customers.md +1 -1
  9. package/dist/developer/core-concepts/events.md +1 -1
  10. package/dist/developer/core-concepts/fulfillments.md +278 -0
  11. package/dist/developer/core-concepts/imports-exports.md +6 -18
  12. package/dist/developer/core-concepts/inventory.md +3 -3
  13. package/dist/developer/core-concepts/media.md +1 -1
  14. package/dist/developer/core-concepts/metafields.md +1 -1
  15. package/dist/developer/core-concepts/orders.md +92 -339
  16. package/dist/developer/core-concepts/payments.md +1 -1
  17. package/dist/developer/core-concepts/promotions.md +68 -195
  18. package/dist/developer/core-concepts/returns-exchanges-claims.md +173 -0
  19. package/dist/developer/core-concepts/store-credits-gift-cards.md +16 -18
  20. package/dist/developer/core-concepts/stores.md +1 -1
  21. package/dist/developer/core-concepts/taxes-discounts-fees.md +199 -0
  22. package/dist/developer/core-concepts/taxes.md +3 -3
  23. package/dist/developer/create-spree-app/quickstart.md +1 -1
  24. package/dist/developer/customization/api.md +36 -11
  25. package/dist/developer/customization/configuration.md +207 -37
  26. package/dist/developer/customization/decorators.md +8 -8
  27. package/dist/developer/customization/permissions.md +34 -229
  28. package/dist/developer/customization/quickstart.md +159 -108
  29. package/dist/developer/customization/validations.md +1 -1
  30. package/dist/developer/dashboard/overview.md +1 -1
  31. package/dist/developer/how-to/build-a-b2b-store.md +21 -0
  32. package/dist/developer/how-to/build-a-marketplace.md +25 -0
  33. package/dist/developer/how-to/custom-api-authentication.md +1 -1
  34. package/dist/developer/how-to/custom-delivery-rate-provider.md +242 -0
  35. package/dist/developer/how-to/custom-document-numbers.md +154 -0
  36. package/dist/developer/how-to/custom-order-routing.md +1 -1
  37. package/dist/developer/how-to/custom-payment-method.md +1 -1
  38. package/dist/developer/how-to/custom-promotion.md +76 -115
  39. package/dist/developer/how-to/custom-report.md +2 -2
  40. package/dist/developer/how-to/custom-stock-splitter.md +5 -5
  41. package/dist/developer/how-to/sell-digital-products.md +20 -0
  42. package/dist/developer/multi-tenant/quickstart.md +1 -1
  43. package/dist/developer/providers/dam.md +14 -0
  44. package/dist/developer/providers/erp.md +31 -0
  45. package/dist/developer/providers/fulfillment.md +25 -0
  46. package/dist/developer/{deployment/telemetry.md → providers/observability.md} +1 -1
  47. package/dist/developer/providers/overview.md +44 -0
  48. package/dist/developer/providers/pim.md +25 -0
  49. package/dist/developer/providers/sso.md +20 -0
  50. package/dist/developer/sdk/admin/extending.md +1 -1
  51. package/dist/developer/sdk/admin/quickstart.md +1 -1
  52. package/dist/developer/sdk/admin/resources.md +1 -1
  53. package/dist/developer/sdk/extending.md +1 -1
  54. package/dist/developer/tutorial/admin-api.md +13 -0
  55. package/dist/developer/tutorial/dashboard-plugin.md +14 -0
  56. package/dist/developer/tutorial/events.md +7 -161
  57. package/dist/developer/tutorial/introduction.md +15 -35
  58. package/dist/developer/tutorial/model.md +7 -98
  59. package/dist/developer/tutorial/store-api.md +13 -0
  60. package/dist/developer/tutorial/storefront.md +12 -0
  61. package/dist/developer/tutorial/testing.md +7 -711
  62. package/dist/developer/upgrades/5.6-to-6.0.md +2 -2
  63. package/package.json +1 -1
  64. package/dist/developer/admin/admin.md +0 -214
  65. package/dist/developer/admin/authentication.md +0 -59
  66. package/dist/developer/admin/components.md +0 -711
  67. package/dist/developer/admin/custom-css.md +0 -256
  68. package/dist/developer/admin/custom-javascript.md +0 -116
  69. package/dist/developer/admin/extending-ui.md +0 -1839
  70. package/dist/developer/admin/form-builder.md +0 -444
  71. package/dist/developer/admin/helper-methods.md +0 -531
  72. package/dist/developer/admin/navigation.md +0 -805
  73. package/dist/developer/admin/tables.md +0 -490
  74. package/dist/developer/advanced/adding_spree_to_rails_app.md +0 -92
  75. package/dist/developer/core-concepts/adjustments.md +0 -113
  76. package/dist/developer/core-concepts/reports.md +0 -208
  77. package/dist/developer/core-concepts/shipments.md +0 -307
  78. package/dist/developer/core-concepts/users.md +0 -303
  79. package/dist/developer/customization/authentication.md +0 -100
  80. package/dist/developer/customization/checkout.md +0 -202
  81. package/dist/developer/customization/emails.md +0 -18
  82. package/dist/developer/customization/routes.md +0 -24
  83. package/dist/developer/multi-vendor/installation.md +0 -61
  84. package/dist/developer/multi-vendor/quickstart.md +0 -17
  85. package/dist/developer/tutorial/admin.md +0 -206
  86. package/dist/developer/tutorial/api.md +0 -606
  87. package/dist/developer/tutorial/extending-models.md +0 -393
  88. package/dist/developer/tutorial/sdk.md +0 -170
  89. package/dist/developer/upgrades/2.0-to-2.1.md +0 -46
  90. package/dist/developer/upgrades/2.1-to-2.2.md +0 -59
  91. package/dist/developer/upgrades/2.2-to-2.3.md +0 -44
  92. package/dist/developer/upgrades/2.3-to-2.4.md +0 -42
  93. package/dist/developer/upgrades/3.0-to-3.1.md +0 -47
  94. package/dist/developer/upgrades/3.1-to-3.2.md +0 -34
  95. package/dist/developer/upgrades/3.2-to-3.3.md +0 -70
  96. package/dist/developer/upgrades/3.3-to-3.4.md +0 -36
  97. package/dist/developer/upgrades/3.4-to-3.5.md +0 -44
  98. package/dist/developer/upgrades/3.5-to-3.6.md +0 -40
  99. package/dist/developer/upgrades/3.6-to-3.7.md +0 -62
  100. package/dist/developer/upgrades/3.7-to-4.0.md +0 -152
  101. package/dist/developer/upgrades/4.0-to-4.1.md +0 -92
  102. package/dist/developer/upgrades/4.1-to-4.2.md +0 -109
  103. package/dist/developer/upgrades/4.10-to-5.0.md +0 -131
  104. package/dist/developer/upgrades/4.2-to-4.3.md +0 -100
  105. package/dist/developer/upgrades/4.3-to-4.4.md +0 -125
  106. package/dist/developer/upgrades/4.4-to-4.5.md +0 -94
  107. package/dist/developer/upgrades/4.5-to-4.6.md +0 -119
  108. package/dist/developer/upgrades/4.6-to-4.7.md +0 -39
  109. package/dist/developer/upgrades/4.8-to-4.9.md +0 -24
  110. package/dist/developer/upgrades/4.9-to-4.10.md +0 -24
  111. package/dist/developer/upgrades/4.x-to-4.8.md +0 -52
  112. package/dist/developer/upgrades/5.0-to-5.1.md +0 -28
  113. package/dist/developer/upgrades/5.1-to-5.2.md +0 -131
  114. package/dist/developer/upgrades/5.2-to-5.3.md +0 -338
  115. package/dist/developer/upgrades/5.3-to-5.4.md +0 -277
  116. package/dist/developer/upgrades/5.4-to-5.5.md +0 -301
  117. package/dist/developer/upgrades/5.5-to-5.6.md +0 -207
@@ -1,256 +0,0 @@
1
- ---
2
- title: Admin Dashboard Custom CSS
3
- sidebarTitle: Custom CSS
4
- description: Customize the Spree Admin Dashboard with your own CSS by overriding Tailwind variables, adding custom styles, and extending admin views and helpers.
5
- ---
6
-
7
- Spree Admin Dashboard uses [Tailwind CSS v4](https://tailwindcss.com/) for styling. The stylesheet system is designed to be easily customizable while maintaining consistency with the Spree design system.
8
-
9
- ## How It Works
10
-
11
- When you install Spree Admin, the installer creates a file at `app/assets/tailwind/spree_admin.css` in your application. This file:
12
-
13
- 1. Imports the base Spree Admin styles from the gem
14
- 2. Scans your custom admin views, helpers, and JavaScript for Tailwind classes
15
- 3. Allows you to add custom styles and override theme variables
16
-
17
- ## Using Tailwind Utility Classes
18
-
19
- You can use any Tailwind CSS utility class in your custom admin views, helpers, or JavaScript files. The build process automatically scans these locations:
20
-
21
- - `app/views/spree/admin/**/*.erb`
22
- - `app/helpers/spree/admin/**/*.rb`
23
- - `app/javascript/spree/admin/**/*.js`
24
-
25
- Example usage in a view:
26
-
27
- ```erb
28
- <div class="bg-zinc-100 p-4 rounded-lg shadow-sm">
29
- <h2 class="text-lg font-bold text-zinc-900">Custom Section</h2>
30
- <p class="text-sm text-zinc-600 mt-2">Your content here</p>
31
- </div>
32
- ```
33
-
34
- ## Customizing the Theme
35
-
36
- ### Overriding Theme Colors
37
-
38
- To override Tailwind theme values, add a `@theme` block in your `app/assets/tailwind/spree_admin.css` file after the import:
39
-
40
- ```css app/assets/tailwind/spree_admin.css
41
- /* Import Spree Admin base styles from the gem */
42
- @import "$SPREE_ADMIN_PATH/app/assets/tailwind/spree/admin/index.css";
43
-
44
- /* Override theme colors */
45
- @theme {
46
- --color-primary: #4F46E5; /* Change primary color to indigo */
47
- --color-success: #059669; /* Custom success color */
48
- --color-danger: #DC2626; /* Custom danger color */
49
- }
50
- ```
51
-
52
- ### Available Theme Variables
53
-
54
- The Spree Admin theme defines these customizable variables:
55
-
56
- | Variable | Default | Description |
57
- |----------|---------|-------------|
58
- | `--color-primary` | `var(--color-zinc-950)` | Primary brand color |
59
- | `--color-success` | `var(--color-green-900)` | Success state color |
60
- | `--color-danger` | `var(--color-red-600)` | Error/danger state color |
61
- | `--color-warning` | `var(--color-yellow-900)` | Warning state color |
62
- | `--color-info` | `var(--color-blue-900)` | Info state color |
63
-
64
- ### Overriding Layout Variables
65
-
66
- You can also customize layout-related CSS variables:
67
-
68
- ```css app/assets/tailwind/spree_admin.css
69
- :root {
70
- --spacing-sidebar-width: 280px; /* Default: 220px */
71
- --spacing-sidebar-collapsed: 70px; /* Default: 59px */
72
- --spacing-header-height: 64px; /* Default: 58px */
73
- }
74
- ```
75
-
76
- ## Adding Custom Components
77
-
78
- Use Tailwind's `@layer` directive to add custom component styles that work seamlessly with the existing design:
79
-
80
- ```css app/assets/tailwind/spree_admin.css
81
- @layer components {
82
- /* Custom card style */
83
- .my-custom-card {
84
- @apply bg-white rounded-lg shadow-sm border border-zinc-200 p-4;
85
- }
86
-
87
- /* Custom button variant */
88
- .btn-custom {
89
- @apply inline-flex items-center px-4 py-2 rounded-md;
90
- @apply bg-indigo-600 text-white font-medium;
91
- @apply hover:bg-indigo-700 transition-colors;
92
- }
93
-
94
- /* Custom status badge */
95
- .status-badge {
96
- @apply inline-flex items-center px-2 py-1 rounded-full text-xs font-medium;
97
- }
98
-
99
- .status-badge-active {
100
- @apply status-badge bg-green-100 text-green-800;
101
- }
102
-
103
- .status-badge-inactive {
104
- @apply status-badge bg-zinc-100 text-zinc-600;
105
- }
106
- }
107
- ```
108
-
109
- ## Adding Custom Utilities
110
-
111
- For reusable utility classes, use the utilities layer:
112
-
113
- ```css app/assets/tailwind/spree_admin.css
114
- @layer utilities {
115
- .text-gradient {
116
- @apply bg-clip-text text-transparent bg-gradient-to-r from-indigo-500 to-purple-500;
117
- }
118
-
119
- .scrollbar-hidden {
120
- -ms-overflow-style: none;
121
- scrollbar-width: none;
122
- }
123
-
124
- .scrollbar-hidden::-webkit-scrollbar {
125
- display: none;
126
- }
127
- }
128
- ```
129
-
130
- ## Scanning Additional Paths
131
-
132
- If you have admin-related code in non-standard locations, add additional `@source` directives:
133
-
134
- ```css app/assets/tailwind/spree_admin.css
135
- /* Scan host app's custom admin code for Tailwind classes */
136
- @source "../../views/spree/admin/**/*.erb";
137
- @source "../../helpers/spree/admin/**/*.rb";
138
- @source "../../javascript/spree/admin/**/*.js";
139
-
140
- /* Add your custom paths */
141
- @source "../../components/admin/**/*.erb";
142
- @source "../../views/admin/**/*.erb";
143
- ```
144
-
145
- ## Development Workflow
146
-
147
- ### Starting the CSS Watcher
148
-
149
- During development, run the Tailwind CSS watcher to automatically rebuild styles when you make changes:
150
-
151
-
152
- ```bash Spree CLI (Docker)
153
- spree rake spree:admin:tailwindcss:watch
154
- ```
155
-
156
- ```bash Without Spree CLI
157
- bundle exec rake spree:admin:tailwindcss:watch
158
- ```
159
-
160
-
161
- Or run the full development process, which includes the watcher when it's defined in `Procfile.dev`:
162
-
163
-
164
- ```bash Spree CLI (Docker)
165
- spree dev
166
- ```
167
-
168
- ```bash Without Spree CLI
169
- bin/dev
170
- ```
171
-
172
-
173
- The watcher monitors:
174
- - Your host app's CSS files in `app/assets/tailwind/`
175
- - The Spree Admin engine's CSS files
176
- - All files matching your `@source` patterns
177
-
178
- ### Building for Production
179
-
180
- CSS is automatically compiled during asset precompilation:
181
-
182
- ```bash
183
- bin/rails assets:precompile
184
- ```
185
-
186
- ## Common Customization Examples
187
-
188
- ### Custom Primary Color Scheme
189
-
190
- ```css app/assets/tailwind/spree_admin.css
191
- @theme {
192
- /* Use blue as the primary color */
193
- --color-primary: #2563EB;
194
- }
195
-
196
- @layer components {
197
- /* Ensure buttons use the new primary color */
198
- .btn-primary {
199
- @apply bg-blue-600 hover:bg-blue-700;
200
- }
201
- }
202
- ```
203
-
204
- ### Dark Mode Adjustments
205
-
206
- ```css app/assets/tailwind/spree_admin.css
207
- @layer base {
208
- /* Custom dark mode overrides */
209
- .dark {
210
- --color-primary: #60A5FA;
211
- }
212
- }
213
- ```
214
-
215
- ### Custom Form Styling
216
-
217
- ```css app/assets/tailwind/spree_admin.css
218
- @layer components {
219
- /* Custom input style */
220
- .input-custom {
221
- @apply block w-full rounded-md border-zinc-300 shadow-sm;
222
- @apply focus:border-indigo-500 focus:ring-indigo-500;
223
- }
224
-
225
- /* Custom select style */
226
- .select-custom {
227
- @apply block w-full rounded-md border-zinc-300 py-2 pl-3 pr-10;
228
- @apply focus:border-indigo-500 focus:outline-none focus:ring-indigo-500;
229
- }
230
- }
231
- ```
232
-
233
- ## Troubleshooting
234
-
235
- ### Changes Not Appearing
236
-
237
- 1. Ensure the watcher is running: `bin/rails spree:admin:tailwindcss:watch`
238
- 2. Check that your files are in paths covered by `@source` directives
239
- 3. Hard refresh the browser (Cmd+Shift+R or Ctrl+Shift+R)
240
-
241
- ### Missing Utility Classes
242
-
243
- If a Tailwind class isn't working, ensure:
244
- 1. The class is used in a file that's scanned by `@source`
245
- 2. The class name is complete (not dynamically constructed)
246
- 3. Run a fresh build: `bin/rails spree:admin:tailwindcss:build`
247
-
248
- ### Listen Gem Required
249
-
250
- The watch task requires the `listen` gem. Add it to your Gemfile:
251
-
252
- ```ruby Gemfile
253
- group :development do
254
- gem 'listen', '>= 3.0'
255
- end
256
- ```
@@ -1,116 +0,0 @@
1
- ---
2
- title: Custom JavaScript for Admin Dashboard
3
- sidebarTitle: Custom JavaScript
4
- description: Learn how to add custom JavaScript to your Spree Admin Dashboard
5
- ---
6
-
7
- ## Extending Admin Dashboard with JavaScript
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/). It's a very simple and minimalistic framework only enhancing our server-side rendered HTML with a bit of interactivity.
10
-
11
- ### 3rd party JavaScript libraries
12
-
13
- Spree Admin Dashboard comes with a few 3rd party JavaScript libraries already included.
14
-
15
- Main libraries we're using:
16
-
17
- * [Stimulus.js](https://stimulus.hotwired.dev/)
18
- * [Turbo](https://turbo.hotwired.dev/)
19
- * [EasyPick](https://easepick.com/) (date picker)
20
- * [TomSelect](https://tom-select.js.org/) (autocomplete/dropdowns)
21
- * [Sortable.js](https://github.com/SortableJS/Sortable) - sortable drag and drop lists
22
- * [Uppy](https://uppy.io/) - file uploader
23
-
24
- You can find them in the [app/assets/javascripts/vendor](https://github.com/spree/spree/blob/main/admin/vendor/javascript) directory.
25
-
26
- ### Managing JavaScript dependencies
27
-
28
- You're probably wondering why these libraries are in the `vendor` directory, and not in `node_modules`.
29
-
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
-
32
- We're using a tool called [Importmaps](https://github.com/rails/importmap-rails) to manage dependencies.
33
-
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
-
36
- #### Install dependencies
37
-
38
- To install dependencies you need to run the following command:
39
-
40
- ```bash
41
- bin/importmap pin react
42
- ```
43
-
44
- This will install the dependencies, download the files to your `vendor/javascript` directory and add them to your `config/importmap.rb` file, eg.
45
-
46
- ```ruby
47
- pin "react" # @19.1.0
48
- ```
49
-
50
- Now you can just import the library in your application entry point, eg. `application.js`:
51
-
52
- ```js
53
- import "react";
54
- ```
55
-
56
- ### Application entry point
57
-
58
- Mentioned above, the application entry point is the `application.js` file. It's located in the `app/javascript` directory.
59
-
60
- If you want to add custom JavaScript to your Spree Admin Dashboard, you can do so by adding a new file to the `app/javascript` directory.
61
-
62
- ### Stimulus Controllers
63
-
64
- Stimulus controllers are a way to add interactivity to your Spree Admin Dashboard. Admin Dashboard controllers can be found in the Spree repository in the [Admin Dashboard/app/javascript/spree/admin/controllers](https://github.com/spree/spree/tree/main/admin/app/javascript/spree/admin/controllers) directory.
65
-
66
- You can find more information about Stimulus controllers in the [Stimulus.js documentation](https://stimulus.hotwired.dev/handbook/controllers).
67
-
68
- To add a new controller you need to create a new file in the `app/javascript/controllers` directory. It will be automatically picked up by the application.
69
-
70
- ```js
71
- // app/javascript/controllers/hello_controller.js
72
- import { Controller } from '@hotwired/stimulus'
73
-
74
- export default class extends Controller {
75
- connect() {
76
- console.log("Hello Spree Commerce Stimulus!", this.element);
77
- }
78
- }
79
- ```
80
-
81
- To use the controller in your HTML you need to add the `data-controller` attribute to your element, eg.
82
-
83
- ```html
84
- <div data-controller="hello">
85
- Hello Spree Commerce Stimulus!
86
- </div>
87
- ```
88
-
89
- ## JavaScript snippets
90
-
91
- If you need to add a small piece of JavaScript code (eg. tracking, marketing, analytics, customer service etc.) you can do this by:
92
-
93
- 1. Declaring a new head partial in the `config/initializers/spree.rb` file, eg.
94
-
95
- **Spree 5.2+:**
96
-
97
- ```ruby config/initializers/spree.rb
98
- Rails.application.config.after_initialize do
99
- Spree.admin.partials.head << 'spree/admin/shared/my_tracking_code'
100
- end
101
- ```
102
-
103
- **Spree 5.1 and below:**
104
-
105
- ```ruby config/initializers/spree.rb
106
- Rails.application.config.spree_admin.head_partials << 'spree/admin/shared/my_tracking_code'
107
- ```
108
-
109
-
110
- 2. Creating a new partial file `app/views/spree/admin/shared/_my_tracking_code.html.erb` (note the leading underscore — it's rendered as a partial), where you can add your tracking code, eg.
111
-
112
- ```erb app/views/spree/admin/shared/_my_tracking_code.html.erb
113
- <script>
114
- console.log("I'm a spy!");
115
- </script>
116
- ```