@spree/docs 0.1.0

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 (183) hide show
  1. package/README.md +54 -0
  2. package/dist/api-reference/platform/authentication.md +38 -0
  3. package/dist/api-reference/store-api/authentication.md +188 -0
  4. package/dist/api-reference/store-api/errors.md +277 -0
  5. package/dist/api-reference/store-api/idempotency.md +129 -0
  6. package/dist/api-reference/store-api/introduction.md +34 -0
  7. package/dist/api-reference/store-api/localization.md +279 -0
  8. package/dist/api-reference/store-api/metadata.md +160 -0
  9. package/dist/api-reference/store-api/monetary-amounts.md +65 -0
  10. package/dist/api-reference/store-api/querying.md +399 -0
  11. package/dist/api-reference/store-api/rate-limitting.md +103 -0
  12. package/dist/api-reference/store-api/relations.md +185 -0
  13. package/dist/api-reference/storefront/authentication.md +88 -0
  14. package/dist/api-reference/tutorials/adyen-integration-guide-for-android.md +165 -0
  15. package/dist/api-reference/tutorials/adyen-integration-guide-for-ios.md +194 -0
  16. package/dist/api-reference/tutorials/quick-checkout-with-stripe.md +248 -0
  17. package/dist/api-reference/v2/fetching-multiple-resources.md +26 -0
  18. package/dist/api-reference/v2/filtering-and-sorting.md +53 -0
  19. package/dist/api-reference/v2/introduction.md +22 -0
  20. package/dist/api-reference/v2/pagination.md +37 -0
  21. package/dist/api-reference/webhooks-events.md +883 -0
  22. package/dist/developer/admin/admin.md +205 -0
  23. package/dist/developer/admin/authentication.md +59 -0
  24. package/dist/developer/admin/components.md +711 -0
  25. package/dist/developer/admin/custom-css.md +243 -0
  26. package/dist/developer/admin/custom-javascript.md +116 -0
  27. package/dist/developer/admin/extending-ui.md +1964 -0
  28. package/dist/developer/admin/form-builder.md +444 -0
  29. package/dist/developer/admin/helper-methods.md +531 -0
  30. package/dist/developer/admin/navigation.md +805 -0
  31. package/dist/developer/admin/tables.md +491 -0
  32. package/dist/developer/advanced/adding_spree_to_rails_app.md +106 -0
  33. package/dist/developer/cli/quickstart.md +137 -0
  34. package/dist/developer/contributing/creating-an-extension.md +258 -0
  35. package/dist/developer/contributing/developing-spree.md +339 -0
  36. package/dist/developer/contributing/quickstart.md +32 -0
  37. package/dist/developer/contributing/updating-extensions.md +67 -0
  38. package/dist/developer/core-concepts/addresses.md +265 -0
  39. package/dist/developer/core-concepts/adjustments.md +107 -0
  40. package/dist/developer/core-concepts/architecture.md +177 -0
  41. package/dist/developer/core-concepts/calculators.md +323 -0
  42. package/dist/developer/core-concepts/customers.md +230 -0
  43. package/dist/developer/core-concepts/events.md +624 -0
  44. package/dist/developer/core-concepts/imports-exports.md +698 -0
  45. package/dist/developer/core-concepts/inventory.md +191 -0
  46. package/dist/developer/core-concepts/markets.md +250 -0
  47. package/dist/developer/core-concepts/media.md +167 -0
  48. package/dist/developer/core-concepts/metafields.md +187 -0
  49. package/dist/developer/core-concepts/orders.md +328 -0
  50. package/dist/developer/core-concepts/payments.md +710 -0
  51. package/dist/developer/core-concepts/pricing.md +163 -0
  52. package/dist/developer/core-concepts/products.md +360 -0
  53. package/dist/developer/core-concepts/promotions.md +322 -0
  54. package/dist/developer/core-concepts/reports.md +206 -0
  55. package/dist/developer/core-concepts/search-filtering.md +237 -0
  56. package/dist/developer/core-concepts/shipments.md +212 -0
  57. package/dist/developer/core-concepts/slugs.md +111 -0
  58. package/dist/developer/core-concepts/staff-roles.md +123 -0
  59. package/dist/developer/core-concepts/store-credits-gift-cards.md +317 -0
  60. package/dist/developer/core-concepts/stores.md +117 -0
  61. package/dist/developer/core-concepts/taxes.md +135 -0
  62. package/dist/developer/core-concepts/translations.md +120 -0
  63. package/dist/developer/core-concepts/users.md +299 -0
  64. package/dist/developer/core-concepts/webhooks.md +378 -0
  65. package/dist/developer/create-spree-app/quickstart.md +158 -0
  66. package/dist/developer/customization/api.md +93 -0
  67. package/dist/developer/customization/authentication.md +88 -0
  68. package/dist/developer/customization/checkout.md +204 -0
  69. package/dist/developer/customization/configuration.md +55 -0
  70. package/dist/developer/customization/decorators.md +523 -0
  71. package/dist/developer/customization/dependencies.md +232 -0
  72. package/dist/developer/customization/emails.md +21 -0
  73. package/dist/developer/customization/extensions.md +92 -0
  74. package/dist/developer/customization/metadata.md +236 -0
  75. package/dist/developer/customization/model-preferences.md +130 -0
  76. package/dist/developer/customization/permissions.md +265 -0
  77. package/dist/developer/customization/quickstart.md +229 -0
  78. package/dist/developer/customization/routes.md +24 -0
  79. package/dist/developer/customization/v4/admin-panel.md +78 -0
  80. package/dist/developer/customization/v4/authentication.md +210 -0
  81. package/dist/developer/customization/v4/checkout.md +212 -0
  82. package/dist/developer/customization/v4/deface.md +251 -0
  83. package/dist/developer/customization/v4/images.md +86 -0
  84. package/dist/developer/customization/v4/storefront.md +450 -0
  85. package/dist/developer/deployment/assets.md +87 -0
  86. package/dist/developer/deployment/aws.md +335 -0
  87. package/dist/developer/deployment/caching.md +27 -0
  88. package/dist/developer/deployment/cdn.md +39 -0
  89. package/dist/developer/deployment/database.md +155 -0
  90. package/dist/developer/deployment/docker.md +128 -0
  91. package/dist/developer/deployment/emails.md +77 -0
  92. package/dist/developer/deployment/environment_variables.md +111 -0
  93. package/dist/developer/deployment/heroku.md +51 -0
  94. package/dist/developer/deployment/render.md +95 -0
  95. package/dist/developer/getting-started/quickstart.md +82 -0
  96. package/dist/developer/how-to/custom-payment-method.md +374 -0
  97. package/dist/developer/how-to/custom-promotion.md +373 -0
  98. package/dist/developer/how-to/custom-report.md +387 -0
  99. package/dist/developer/how-to/custom-search-provider.md +230 -0
  100. package/dist/developer/multi-store/quickstart.md +71 -0
  101. package/dist/developer/multi-store/setup.md +38 -0
  102. package/dist/developer/multi-tenant/configuration.md +41 -0
  103. package/dist/developer/multi-tenant/core-concepts.md +75 -0
  104. package/dist/developer/multi-tenant/installation.md +96 -0
  105. package/dist/developer/multi-tenant/quickstart.md +20 -0
  106. package/dist/developer/multi-vendor/installation.md +45 -0
  107. package/dist/developer/multi-vendor/quickstart.md +17 -0
  108. package/dist/developer/sdk/admin/quickstart.md +22 -0
  109. package/dist/developer/sdk/authentication.md +89 -0
  110. package/dist/developer/sdk/configuration.md +225 -0
  111. package/dist/developer/sdk/quickstart.md +82 -0
  112. package/dist/developer/sdk/store/account.md +67 -0
  113. package/dist/developer/sdk/store/cart-checkout.md +140 -0
  114. package/dist/developer/sdk/store/markets.md +151 -0
  115. package/dist/developer/sdk/store/payments.md +96 -0
  116. package/dist/developer/sdk/store/products.md +149 -0
  117. package/dist/developer/sdk/store/wishlists.md +52 -0
  118. package/dist/developer/security/pci_compliance.md +15 -0
  119. package/dist/developer/security/security_policy.md +68 -0
  120. package/dist/developer/storefront/blocks.md +285 -0
  121. package/dist/developer/storefront/custom-css.md +260 -0
  122. package/dist/developer/storefront/custom-javascript.md +166 -0
  123. package/dist/developer/storefront/helper-methods.md +1288 -0
  124. package/dist/developer/storefront/links.md +298 -0
  125. package/dist/developer/storefront/nextjs/architecture.md +150 -0
  126. package/dist/developer/storefront/nextjs/customization.md +141 -0
  127. package/dist/developer/storefront/nextjs/deployment.md +180 -0
  128. package/dist/developer/storefront/nextjs/quickstart.md +92 -0
  129. package/dist/developer/storefront/nextjs/spree-next-package.md +314 -0
  130. package/dist/developer/storefront/pages.md +163 -0
  131. package/dist/developer/storefront/sections.md +569 -0
  132. package/dist/developer/storefront/storefront.md +56 -0
  133. package/dist/developer/storefront/themes.md +161 -0
  134. package/dist/developer/tutorial/admin.md +134 -0
  135. package/dist/developer/tutorial/extending-models.md +380 -0
  136. package/dist/developer/tutorial/file-uploads.md +121 -0
  137. package/dist/developer/tutorial/introduction.md +33 -0
  138. package/dist/developer/tutorial/model.md +41 -0
  139. package/dist/developer/tutorial/page-builder.md +487 -0
  140. package/dist/developer/tutorial/rich-text.md +73 -0
  141. package/dist/developer/tutorial/seo.md +332 -0
  142. package/dist/developer/tutorial/storefront.md +352 -0
  143. package/dist/developer/tutorial/testing.md +558 -0
  144. package/dist/developer/upgrades/2.0-to-2.1.md +46 -0
  145. package/dist/developer/upgrades/2.1-to-2.2.md +59 -0
  146. package/dist/developer/upgrades/2.2-to-2.3.md +44 -0
  147. package/dist/developer/upgrades/2.3-to-2.4.md +42 -0
  148. package/dist/developer/upgrades/3.0-to-3.1.md +47 -0
  149. package/dist/developer/upgrades/3.1-to-3.2.md +34 -0
  150. package/dist/developer/upgrades/3.2-to-3.3.md +70 -0
  151. package/dist/developer/upgrades/3.3-to-3.4.md +36 -0
  152. package/dist/developer/upgrades/3.4-to-3.5.md +44 -0
  153. package/dist/developer/upgrades/3.5-to-3.6.md +40 -0
  154. package/dist/developer/upgrades/3.6-to-3.7.md +62 -0
  155. package/dist/developer/upgrades/3.7-to-4.0.md +152 -0
  156. package/dist/developer/upgrades/4.0-to-4.1.md +92 -0
  157. package/dist/developer/upgrades/4.1-to-4.2.md +109 -0
  158. package/dist/developer/upgrades/4.10-to-5.0.md +129 -0
  159. package/dist/developer/upgrades/4.2-to-4.3.md +100 -0
  160. package/dist/developer/upgrades/4.3-to-4.4.md +125 -0
  161. package/dist/developer/upgrades/4.4-to-4.5.md +94 -0
  162. package/dist/developer/upgrades/4.5-to-4.6.md +119 -0
  163. package/dist/developer/upgrades/4.6-to-4.7.md +39 -0
  164. package/dist/developer/upgrades/4.8-to-4.9.md +24 -0
  165. package/dist/developer/upgrades/4.9-to-4.10.md +24 -0
  166. package/dist/developer/upgrades/4.x-to-4.8.md +52 -0
  167. package/dist/developer/upgrades/5.0-to-5.1.md +28 -0
  168. package/dist/developer/upgrades/5.1-to-5.2.md +127 -0
  169. package/dist/developer/upgrades/5.2-to-5.3.md +338 -0
  170. package/dist/developer/upgrades/5.3-to-5.4.md +248 -0
  171. package/dist/developer/upgrades/quickstart.md +36 -0
  172. package/dist/integrations/analytics/google-analytics.md +64 -0
  173. package/dist/integrations/analytics/google-tag-manager.md +78 -0
  174. package/dist/integrations/integrations.md +39 -0
  175. package/dist/integrations/marketing/klaviyo.md +99 -0
  176. package/dist/integrations/payments/adyen.md +90 -0
  177. package/dist/integrations/payments/paypal.md +41 -0
  178. package/dist/integrations/payments/razorpay.md +45 -0
  179. package/dist/integrations/payments/stripe.md +109 -0
  180. package/dist/integrations/search/meilisearch.md +236 -0
  181. package/dist/integrations/sso-mfa-social-login/admin-dashboard.md +57 -0
  182. package/dist/integrations/sso-mfa-social-login/storefront.md +56 -0
  183. package/package.json +27 -0
@@ -0,0 +1,531 @@
1
+ ---
2
+ title: Admin Dashboard Helper Methods
3
+ sidebarTitle: Helper Methods
4
+ ---
5
+
6
+ Helper methods available in the Admin Dashboard for navigation, links, and utility functions.
7
+
8
+ > **INFO:** For UI components that render HTML elements (Dropdowns, Dialogs, Icons, etc.), see the [Components](/developer/admin/components) documentation.
9
+
10
+ ## Navigation Helpers
11
+
12
+ ### `nav_item`
13
+
14
+ Creates a navigation item with optional icon.
15
+
16
+ ```erb
17
+ <%= nav_item 'Dashboard', spree.admin_dashboard_path %>
18
+ <%= nav_item 'Products', spree.admin_products_path, icon: 'package' %>
19
+ <%= nav_item 'Orders', spree.admin_orders_path, active: true %>
20
+ ```
21
+
22
+ With a block for custom content:
23
+
24
+ ```erb
25
+ <%= nav_item spree.admin_products_path do %>
26
+ Products <span class="badge badge-primary">New</span>
27
+ <% end %>
28
+ ```
29
+
30
+ | Option | Type | Description |
31
+ |--------|------|-------------|
32
+ | `label` | String | The text to display |
33
+ | `url` | String | The URL for the link (required) |
34
+ | `icon` | String | Icon name to prepend |
35
+ | `active` | Boolean | Force active state |
36
+ | `data` | Hash | Data attributes |
37
+
38
+ ### `link_to_with_icon`
39
+
40
+ Creates a link with an icon.
41
+
42
+ ```erb
43
+ <%= link_to_with_icon 'eye', "View Order", spree.admin_order_path(order), class: "btn btn-primary" %>
44
+ <%= link_to_with_icon 'pencil', "Edit", edit_path, class: "dropdown-item" %>
45
+ <%= link_to_with_icon 'trash', "Delete", delete_path, no_text: true, title: "Delete item" %>
46
+ ```
47
+
48
+ | Parameter | Type | Description |
49
+ |-----------|------|-------------|
50
+ | `icon_name` | String | Icon name from [Tabler Icons](https://tabler.io/icons) |
51
+ | `text` | String | Link text |
52
+ | `url` | String | Link URL (use `spree.` routes for internal links) |
53
+ | `no_text` | Boolean | Show only icon with text as tooltip |
54
+ | `title` | String | Tooltip text |
55
+
56
+ ### `active_link_to_with_icon`
57
+
58
+ Same as `link_to_with_icon`, but adds the `active` class if the current page matches the URL.
59
+
60
+ ```erb
61
+ <%= active_link_to_with_icon 'package', "Products", spree.admin_products_path, class: "nav-link" %>
62
+ ```
63
+
64
+ ### `link_to_edit`
65
+
66
+ Renders an edit button for a resource. Only renders if the user has `update` permission.
67
+
68
+ ```erb
69
+ <%= link_to_edit(@product) %>
70
+ <%= link_to_edit(@product, url: custom_edit_path(@product)) %>
71
+ <%= link_to_edit(@order, class: 'btn btn-primary') %>
72
+ ```
73
+
74
+ | Option | Type | Default | Description |
75
+ |--------|------|---------|-------------|
76
+ | `url` | String | auto | Custom URL (defaults to `edit_object_url(resource)`) |
77
+ | `class` | String | `btn btn-light btn-sm` | CSS classes |
78
+ | `data` | Hash | `{action: 'edit'}` | Data attributes |
79
+
80
+ ### `link_to_delete`
81
+
82
+ Renders a delete button with confirmation. Only renders if the user has `destroy` permission.
83
+
84
+ ```erb
85
+ <%= link_to_delete(@product) %>
86
+ <%= link_to_delete(@product, name: 'Remove') %>
87
+ <%= link_to_delete(@product, no_text: true) %>
88
+ <%= link_to_delete(@product, icon: 'x') %>
89
+ ```
90
+
91
+ | Option | Type | Default | Description |
92
+ |--------|------|---------|-------------|
93
+ | `url` | String | auto | Custom URL (defaults to `object_url(resource)`) |
94
+ | `name` | String | "Delete" | Button text |
95
+ | `icon` | String | `trash` | Custom icon |
96
+ | `no_text` | Boolean | false | Show only icon |
97
+ | `class` | String | `btn btn-danger btn-sm` | CSS classes |
98
+ | `data` | Hash | confirm + method | Data attributes |
99
+
100
+ ### `button`
101
+
102
+ Renders a submit button with optional icon and loading state.
103
+
104
+ ```erb
105
+ <%= button(Spree.t('actions.save')) %>
106
+ <%= button(Spree.t('actions.save'), 'device-floppy') %>
107
+ <%= button('Submit', 'send', 'submit', class: 'btn-success') %>
108
+ ```
109
+
110
+ | Parameter | Type | Default | Description |
111
+ |-----------|------|---------|-------------|
112
+ | `text` | String | required | Button text |
113
+ | `icon_name` | String | nil | Optional icon |
114
+ | `button_type` | String | `submit` | Button type |
115
+ | `class` | String | `btn-primary` | CSS classes |
116
+
117
+ ### `external_link_to`
118
+
119
+ Renders an external link that opens in a new tab with an indicator icon.
120
+
121
+ ```erb
122
+ <%= external_link_to 'Documentation', 'https://docs.spreecommerce.org' %>
123
+ <%= external_link_to 'GitHub', 'https://github.com/spree/spree' %>
124
+ ```
125
+
126
+ With a block:
127
+
128
+ ```erb
129
+ <%= external_link_to 'https://example.com' do %>
130
+ <strong>Custom content</strong>
131
+ <% end %>
132
+ ```
133
+
134
+ | Parameter | Type | Description |
135
+ |-----------|------|-------------|
136
+ | `label` | String | Link text |
137
+ | `url` | String | External URL |
138
+ | `target` | Symbol | Default: `:blank` |
139
+ | `rel` | Symbol | Default: `:nofollow` |
140
+
141
+ ### `external_page_preview_link`
142
+
143
+ Renders a link to preview a resource on the storefront.
144
+
145
+ ```erb
146
+ <%= external_page_preview_link(@product) %>
147
+ <%= external_page_preview_link(@post) %>
148
+ ```
149
+
150
+ ### `page_header_back_button`
151
+
152
+ Renders a back button for page headers with smart return URL handling.
153
+
154
+ ```erb
155
+ <%= page_header_back_button(spree.admin_products_path) %>
156
+ <%= page_header_back_button(spree.admin_products_path, @product) %>
157
+ <%= page_header_back_button(spree.admin_orders_path, @order, 'Back to Orders') %>
158
+ ```
159
+
160
+ | Parameter | Type | Description |
161
+ |-----------|------|-------------|
162
+ | `default_url` | String | Default URL to navigate back to |
163
+ | `object` | Object | Optional object to check for stored return URL in session |
164
+ | `label` | String | Optional label text |
165
+
166
+ ### `per_page_dropdown`
167
+
168
+ Renders a dropdown for selecting items per page on index pages.
169
+
170
+ ```erb
171
+ <%= per_page_dropdown %>
172
+ ```
173
+
174
+ Automatically detects the resource type and provides appropriate options based on configuration.
175
+
176
+ ### `link_to_export_modal`
177
+
178
+ Renders a button to open the export modal. Only renders if user can create exports.
179
+
180
+ ```erb
181
+ <%= link_to_export_modal %>
182
+ ```
183
+
184
+ ## Store Helpers
185
+
186
+ Helpers for store-specific options and unit systems.
187
+
188
+ ### `weight_units`
189
+
190
+ Returns weight unit options based on the store's unit system.
191
+
192
+ ```erb
193
+ <%= f.select :weight_unit, weight_units %>
194
+ ```
195
+
196
+ **Returns:**
197
+ - Metric: `[["Kilogram", "kg"], ["Gram", "g"]]`
198
+ - Imperial: `[["Pound", "lb"], ["Ounce", "oz"]]`
199
+
200
+ | Parameter | Type | Default | Description |
201
+ |-----------|------|---------|-------------|
202
+ | `store` | Spree::Store | `current_store` | Store to check unit system |
203
+
204
+ ### `dimension_units`
205
+
206
+ Returns dimension unit options based on the store's unit system.
207
+
208
+ ```erb
209
+ <%= f.select :dimension_unit, dimension_units %>
210
+ ```
211
+
212
+ **Returns:**
213
+ - Metric: `[["Centimeter", "cm"], ["Millimeter", "mm"]]`
214
+ - Imperial: `[["Inch", "in"], ["Foot", "ft"]]`
215
+
216
+ | Parameter | Type | Default | Description |
217
+ |-----------|------|---------|-------------|
218
+ | `store` | Spree::Store | `current_store` | Store to check unit system |
219
+
220
+ ### `unit_systems`
221
+
222
+ Returns available unit system options.
223
+
224
+ ```erb
225
+ <%= f.select :unit_system, unit_systems %>
226
+ ```
227
+
228
+ **Returns:** `[["Metric System", "metric"], ["Imperial System", "imperial"]]`
229
+
230
+ ### `display_on_options`
231
+
232
+ Returns display location options for calculators and payment/shipping methods.
233
+
234
+ ```erb
235
+ <%= f.select :display_on, display_on_options %>
236
+ ```
237
+
238
+ **Returns:** `[["Both", "both"], ["Backend", "back_end"], ["Frontend", "front_end"]]`
239
+
240
+ ## Turbo Helpers
241
+
242
+ Helpers for Turbo Streams and Turbo-enhanced forms.
243
+
244
+ ### `turbo_close_dialog`
245
+
246
+ Returns a Turbo Stream response that closes the main dialog.
247
+
248
+ ```erb
249
+ <%# In a turbo_stream.erb response %>
250
+ <%= turbo_close_dialog %>
251
+ ```
252
+
253
+ ### `turbo_render_alerts`
254
+
255
+ Returns a Turbo Stream response that updates the alerts frame.
256
+
257
+ ```erb
258
+ <%= turbo_render_alerts %>
259
+ <%= turbo_render_alerts(:custom_alerts) %>
260
+ ```
261
+
262
+ | Parameter | Type | Default | Description |
263
+ |-----------|------|---------|-------------|
264
+ | `frame_name` | Symbol | `:alerts` | Turbo frame to update |
265
+
266
+ ### `turbo_save_button_tag`
267
+
268
+ Creates a save button with loading state for Turbo forms.
269
+
270
+ ```erb
271
+ <%= turbo_save_button_tag %>
272
+ <%= turbo_save_button_tag('Update Product') %>
273
+ <%= turbo_save_button_tag('Save', class: 'btn btn-success') %>
274
+ ```
275
+
276
+ **Features:**
277
+ - Shows spinner during submission
278
+ - Integrates with `turbo-submit-button` Stimulus controller
279
+ - Prevents double submissions
280
+
281
+ | Parameter | Type | Default | Description |
282
+ |-----------|------|---------|-------------|
283
+ | `label` | String | "Save" | Button label |
284
+ | `class` | String | `btn btn-primary text-center` | CSS classes |
285
+
286
+ ## Context Helpers
287
+
288
+ ### `current_store`
289
+
290
+ Returns the current store instance.
291
+
292
+ <details>
293
+ <summary>Properties</summary>
294
+
295
+ - **`name`** (`string`) β€” Store name
296
+ Example: "My Store"
297
+
298
+ - **`url`** (`string`) β€” Store URL
299
+ Example: `https://mystore.com`
300
+
301
+ - **`code`** (`string`) β€” Unique store identifier
302
+ Example: `my-store`
303
+
304
+ - **`mail_from_address`** (`string`) β€” Email address used for sending emails
305
+ Example: `store@example.com`
306
+
307
+ - **`default_currency`** (`string`) β€” Default store currency
308
+ Example: `USD`
309
+
310
+ - **`supported_currencies`** (`string`) β€” List of supported currencies
311
+ Example: `USD,EUR,GBP`
312
+
313
+ - **`default_locale`** (`string`) β€” Default store locale
314
+ Example: `en`
315
+
316
+ - **`supported_locales`** (`string`) β€” List of supported locales
317
+ Example: `en,es,fr`
318
+
319
+ - **`default_country_id`** (`integer`) β€” Default country ID
320
+ Example: `1`
321
+
322
+ - **`default_country`** (`Spree::Country`) β€” Default country
323
+ <details>
324
+ <summary>properties</summary>
325
+
326
+ - **`id`** (`integer`) β€” Country ID
327
+ Example: 1
328
+
329
+ - **`name`** (`string`) β€” Country name
330
+ Example: `United States`
331
+
332
+ - **`iso3`** (`string`) β€” Country ISO3 code
333
+ Example: `USA`
334
+
335
+ - **`iso`** (`string`) β€” Country ISO code
336
+ Example: `US`
337
+
338
+ - **`iso_name`** (`string`) β€” Country ISO name
339
+ Example: `UNITED STATES`
340
+
341
+ - **`states_required`** (`boolean`) β€” Whether states are required for this country
342
+ Example: `true`
343
+
344
+ - **`zipcode_required`** (`boolean`) β€” Whether zipcodes are required for this country
345
+ Example: `true`
346
+
347
+ </details>
348
+
349
+ - **`checkout_zone_id`** (`integer`) β€” Checkout zone ID
350
+ Example: `2`
351
+
352
+ - **`seo_title`** (`string`) β€” SEO title
353
+ Example: `My Amazing Store`
354
+
355
+ - **`meta_description`** (`string`) β€” Meta description for SEO
356
+ Example: `The best products at the best prices`
357
+
358
+ </details>
359
+
360
+ ```erb
361
+ <%= current_store.name %>
362
+ <%= current_store.default_currency %>
363
+ ```
364
+
365
+ ### `current_currency`
366
+
367
+ Returns the currently selected currency for the admin session.
368
+
369
+ ```erb
370
+ <%= current_currency %> <%# => "USD" %>
371
+ ```
372
+
373
+ ### `current_vendor`
374
+
375
+ > **INFO:** Available only in [Spree Enterprise Edition](https://spreecommerce.com/pricing).
376
+
377
+ <details>
378
+ <summary>Properties</summary>
379
+
380
+ - **`id`** (`integer`) β€” Unique vendor identifier
381
+ Example: `1`
382
+
383
+ - **`name`** (`string`) β€” Vendor name
384
+ Example: "My Vendor"
385
+
386
+ - **`state`** (`string`) β€” Vendor state/status
387
+ Example: `active`
388
+
389
+ </details>
390
+
391
+ ### `supported_currencies`
392
+
393
+ Returns the list of supported currencies for the current store.
394
+
395
+ ```erb
396
+ <%= supported_currencies %> <%# => ["USD", "EUR", "GBP"] %>
397
+ ```
398
+
399
+ ### `try_spree_current_user`
400
+
401
+ Returns the current user object or `nil` if not signed in.
402
+
403
+ ```erb
404
+ <%= try_spree_current_user&.email %>
405
+
406
+ <% if try_spree_current_user.present? %>
407
+ Signed in as <%= try_spree_current_user.email %>
408
+ <% end %>
409
+ ```
410
+
411
+ ### `available_countries_iso`
412
+
413
+ Returns ISO codes for countries available for checkout in the current store.
414
+
415
+ ```erb
416
+ <%= available_countries_iso %> <%# => ["US", "CA", "GB"] %>
417
+ ```
418
+
419
+ ## Utility Helpers
420
+
421
+ ### `flag_emoji`
422
+
423
+ Returns the flag emoji for a country ISO code.
424
+
425
+ ```erb
426
+ <%= flag_emoji('US') %> <%# => πŸ‡ΊπŸ‡Έ %>
427
+ <%= flag_emoji('GB') %> <%# => πŸ‡¬πŸ‡§ %>
428
+ <%= flag_emoji('JP') %> <%# => πŸ‡―πŸ‡΅ %>
429
+ ```
430
+
431
+ ### `required_span_tag`
432
+
433
+ Renders a red asterisk indicator for required fields.
434
+
435
+ ```erb
436
+ <%= label_tag :name %>
437
+ <%= required_span_tag %>
438
+ ```
439
+
440
+ **Renders:** `<span class="required font-weight-bold text-danger"> *</span>`
441
+
442
+ ### `error_message_on`
443
+
444
+ Renders validation error messages for a form field.
445
+
446
+ ```erb
447
+ <%= error_message_on(@product, :name) %>
448
+ <%= error_message_on(@order, :email) %>
449
+ ```
450
+
451
+ **Renders:** `<span class="formError">can't be blank</span>`
452
+
453
+ ### `settings_area?`
454
+
455
+ Returns `true` if the current page is in the settings area.
456
+
457
+ ```erb
458
+ <% if settings_area? %>
459
+ <%= render 'spree/admin/shared/settings_sidebar' %>
460
+ <% end %>
461
+ ```
462
+
463
+ ### `enterprise_edition?`
464
+
465
+ Returns `true` if Spree Enterprise Edition is installed.
466
+
467
+ ```erb
468
+ <% if enterprise_edition? %>
469
+ <%= render 'spree/admin/vendors/selector' %>
470
+ <% end %>
471
+ ```
472
+
473
+ ### `allowed_file_types_for_upload`
474
+
475
+ Returns allowed file types for Active Storage uploads.
476
+
477
+ ```erb
478
+ <%= allowed_file_types_for_upload %>
479
+ <%# => ["image/png", "image/jpeg", "image/gif", "image/webp"] %>
480
+ ```
481
+
482
+ ### `render_admin_partials`
483
+
484
+ Renders all registered partials for an injection point.
485
+
486
+ ```erb
487
+ <%= render_admin_partials(:product_form, f: f, product: @product) %>
488
+ <%= render_admin_partials(:order_page_sidebar, order: @order) %>
489
+ ```
490
+
491
+ See [Extending UI](/developer/admin/extending-ui) for more information about injection points.
492
+
493
+ ## Preference Helpers
494
+
495
+ Helpers for rendering preference fields in settings forms.
496
+
497
+ ### `preference_fields`
498
+
499
+ Renders all preference fields for an object.
500
+
501
+ ```erb
502
+ <%= preference_fields(@payment_method, f) %>
503
+ <%= preference_fields(@calculator, f, i18n_scope: 'spree.calculator') %>
504
+ ```
505
+
506
+ ### `preference_field`
507
+
508
+ Renders a single preference field.
509
+
510
+ ```erb
511
+ <%= preference_field(@payment_method, f, :api_key) %>
512
+ ```
513
+
514
+ ### `preference_field_for`
515
+
516
+ Renders a form field based on preference type.
517
+
518
+ ```erb
519
+ <%= preference_field_for(f, :preferred_api_key, type: :string) %>
520
+ <%= preference_field_for(f, :preferred_test_mode, type: :boolean) %>
521
+ <%= preference_field_for(f, :preferred_amount, type: :decimal, step: 0.01) %>
522
+ ```
523
+
524
+ | Type | Rendered Field |
525
+ |------|----------------|
526
+ | `:integer` | Number field |
527
+ | `:decimal` | Number field with step |
528
+ | `:boolean` | Checkbox |
529
+ | `:string` | Text field |
530
+ | `:password` | Password field |
531
+ | `:text` | Text area |