Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Added custom field editing for every record type with a dashboard screen (#14939)

Damian Legawiec9c73a7908dbe
diff --git a/.changeset/custom-fields-more-resources.md b/.changeset/custom-fields-more-resources.md
new file mode 100644
index 0000000000..4bdd12fc15
--- /dev/null
+++ b/.changeset/custom-fields-more-resources.md
@@ -0,0 +1,8 @@
+---
+"@spree/dashboard": minor
+"@spree/dashboard-core": minor
+"@spree/dashboard-ui": minor
+"@spree/admin-sdk": minor
+---
+
+Added custom field editing to variants, option types, sellers, promotions, gift cards, store credits, stock transfers, purchase orders, companies, payment methods, delivery methods, tax rates, product types, media and store settings. Sheets show the custom fields card only once the store defines a field for that type. On the product page, variant and media custom fields save with the sheet's Done, and widgets in their `product.variant.form_fields` and `product.media.form_fields` slots can save on Done through `onSave`. `FormActions` and `useFormSubmitShortcut` accept `dirty` for unsaved changes held outside the form. `client.customFields(ownerType, ownerId)` accepts each of these types.
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yaml
index 706a0309a0..eec4b41afd 100644
--- a/docs/api-reference/admin.yaml
+++ b/docs/api-reference/admin.yaml
@@ -10202,7 +10202,7 @@ paths:
content:
application/json:
example:
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
filename: products.csv
content_type: text/csv
byte_size: 48213
@@ -10210,7 +10210,7 @@ paths:
expires_at: '2026-01-16T12:00:00.000Z'
upload:
method: PUT
- url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJxcmZsMnNod3YwYmR4cWF3ZWFocDZvYjhlYzh5IiwiY29udGVudF90eXBlIjoidGV4dC9jc3YiLCJjb250ZW50X2xlbmd0aCI6NDgyMTMsImNoZWNrc3VtIjoiaGdKTXJSNkRFQjJYTloxelVRVVJWZz09Iiwic2VydmljZV9uYW1lIjoidGVzdCJ9LCJleHAiOiIyMDI2LTAxLTE1VDEyOjA1OjAwLjAwMFoiLCJwdXIiOiJibG9iX3Rva2VuIn19--900c151cd70c1eef5cc5fc5c7fd1d4922ae2063a
+ url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJxcmZsMnNod3YwYmR4cWF3ZWFocDZvYjhlYzh5IiwiY29udGVudF90eXBlIjoidGV4dC9jc3YiLCJjb250ZW50X2xlbmd0aCI6NDgyMTMsImNoZWNrc3VtIjoiaGdKTXJSNkRFQjJYTloxelVRVVJWZz09Iiwic2VydmljZV9uYW1lIjoidGVzdCJ9LCJleHAiOiIyMDI2LTAxLTE1VDEyOjA1OjAwLjAwMFoiLCJwdXIiOiJibG9iX3Rva2VuIn19--a294aa361a67bf05482ee35d5a92f7bda8903373
headers:
Content-Type: text/csv
schema:
@@ -11182,6 +11182,130 @@ paths:
schema:
"$ref": "#/components/schemas/FulfillmentSplitParams"
required: true
+ "/api/v3/admin/gift_cards/{gift_card_id}/custom_fields":
+ get:
+ summary: List gift card custom fields
+ tags:
+ - Gift Cards
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the gift card's custom field values.
+
+ **Required scope:** `read_gift_cards` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('gift_card', 'gc_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /gift_cards/{gift_card_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: gift_card_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/gift_card_batches":
get:
summary: List gift card batches
@@ -14594,7 +14718,7 @@ paths:
example:
data:
- id: opt_UkLWZg9DAJ
- name: foo-size-12
+ name: foo-size-14
label: Size
position: 1
kind: dropdown
@@ -14790,7 +14914,7 @@ paths:
application/json:
example:
id: opt_UkLWZg9DAJ
- name: foo-size-16
+ name: foo-size-18
label: Size
position: 1
kind: dropdown
@@ -14864,7 +14988,7 @@ paths:
application/json:
example:
id: opt_UkLWZg9DAJ
- name: foo-size-18
+ name: foo-size-20
label: Updated Label
position: 1
kind: dropdown
@@ -17948,8 +18072,8 @@ paths:
preorder_ships_at:
quantity: 2
currency: USD
- name: Product 759180
- slug: product-759180
+ name: Product 779180
+ slug: product-779180
options_text: 'Size: S'
price: '10.00'
total: '20.00'
@@ -17964,11 +18088,11 @@ paths:
option_values:
- id: optval_UkLWZg9DAJ
option_type_id: opt_UkLWZg9DAJ
- name: size-11
+ name: size-13
label: S
position: 1
color_code:
- option_type_name: foo-size-21
+ option_type_name: foo-size-23
option_type_label: Size
image_url:
metadata: {}
@@ -18057,8 +18181,8 @@ paths:
preorder_ships_at:
quantity: 3
currency: USD
- name: Product 7799
- slug: product-7799
+ name: Product 7999
+ slug: product-7999
options_text: 'Size: S'
price: '19.99'
total: '59.97'
@@ -18073,233 +18197,6 @@ paths:
option_values:
- id: optval_gbHJdmfrXB
option_type_id: opt_gbHJdmfrXB
- name: size-13
- label: S
- position: 1
- color_code:
- option_type_name: foo-size-23
- option_type_label: Size
- image_url:
- metadata: {}
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- digital_links: []
- external_references: {}
- metadata: {}
- price_source:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- catalog_price: '19.99'
- price_list_id:
- price_list_name:
- catalog_id:
- catalog_name:
- cost_price: '17.00'
- tax_category_id: taxcat_UkLWZg9DAJ
- requestBody:
- content:
- application/json:
- schema:
- "$ref": "#/components/schemas/LineItemCreateParams"
- required: true
- "/api/v3/admin/orders/{order_id}/items/{id}":
- get:
- summary: Show an item
- tags:
- - Orders
- security:
- - api_key: []
- bearer_auth: []
- description: |-
- Returns details of a specific line item.
-
- **Required scope:** `read_orders` (for API-key authentication).
- x-codeSamples:
- - lang: javascript
- label: Spree Admin SDK
- source: |-
- import { createAdminClient } from '@spree/admin-sdk'
-
- const client = createAdminClient({
- baseUrl: 'https://your-store.com',
- secretKey: 'sk_xxx',
- })
-
- const item = await client.orders.items.get('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ')
- - lang: bash
- label: Spree CLI
- source: spree api get /orders/{order_id}/items/{id}
- parameters:
- - name: x-spree-api-key
- in: header
- required: true
- schema:
- type: string
- - name: Authorization
- in: header
- required: true
- description: Bearer token for admin authentication
- schema:
- type: string
- - name: order_id
- in: path
- required: true
- description: Order ID
- schema:
- type: string
- - name: id
- in: path
- required: true
- description: Item ID
- schema:
- type: string
- - name: expand
- in: query
- required: false
- description: Comma-separated associations to expand (e.g., variant, variant.product).
- Use dot notation for nested expand (max 4 levels).
- schema:
- type: string
- - name: fields
- in: query
- required: false
- description: Comma-separated list of fields to include (e.g., quantity,price,total).
- id is always included.
- schema:
- type: string
- responses:
- '200':
- description: item found
- content:
- application/json:
- example:
- id: li_UkLWZg9DAJ
- variant_id: variant_gbHJdmfrXB
- seller_id:
- preorder: false
- preorder_ships_at:
- quantity: 2
- currency: USD
- name: Product 782714
- slug: product-782714
- options_text: 'Size: S'
- price: '10.00'
- total: '20.00'
- adjustment_total: '0.00'
- additional_tax_total: '0.00'
- included_tax_total: '0.00'
- discount_total: '0.00'
- pre_tax_amount: '20.00'
- discounted_amount: '20.00'
- compare_at_amount:
- thumbnail_url:
- option_values:
- - id: optval_UkLWZg9DAJ
- option_type_id: opt_UkLWZg9DAJ
- name: size-14
- label: S
- position: 1
- color_code:
- option_type_name: foo-size-24
- option_type_label: Size
- image_url:
- metadata: {}
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- digital_links: []
- external_references: {}
- metadata: {}
- price_source:
- created_at: '2026-01-15T12:00:00.000Z'
- updated_at: '2026-01-15T12:00:00.000Z'
- catalog_price: '19.99'
- price_list_id:
- price_list_name:
- catalog_id:
- catalog_name:
- cost_price: '17.00'
- tax_category_id: taxcat_UkLWZg9DAJ
- patch:
- summary: Update an item
- tags:
- - Orders
- security:
- - api_key: []
- bearer_auth: []
- description: |-
- Updates an order item quantity or metadata.
-
- **Required scope:** `write_orders` (for API-key authentication).
- x-codeSamples:
- - lang: javascript
- label: Spree Admin SDK
- source: |-
- import { createAdminClient } from '@spree/admin-sdk'
-
- const client = createAdminClient({
- baseUrl: 'https://your-store.com',
- secretKey: 'sk_xxx',
- })
-
- const item = await client.orders.items.update('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ', {
- quantity: 5,
- })
- - lang: bash
- label: Spree CLI
- source: spree api patch /orders/{order_id}/items/{id} -d '{"quantity":5}'
- parameters:
- - name: x-spree-api-key
- in: header
- required: true
- schema:
- type: string
- - name: Authorization
- in: header
- required: true
- description: Bearer token for admin authentication
- schema:
- type: string
- - name: order_id
- in: path
- required: true
- description: Order ID
- schema:
- type: string
- - name: id
- in: path
- required: true
- description: Item ID
- schema:
- type: string
- responses:
- '200':
- description: item updated
- content:
- application/json:
- example:
- id: li_UkLWZg9DAJ
- variant_id: variant_gbHJdmfrXB
- seller_id:
- preorder: false
- preorder_ships_at:
- quantity: 5
- currency: USD
- name: Product 799758
- slug: product-799758
- options_text: 'Size: S'
- price: '19.99'
- total: '99.95'
- adjustment_total: '0.00'
- additional_tax_total: '0.00'
- included_tax_total: '0.00'
- discount_total: '0.00'
- pre_tax_amount: '99.95'
- discounted_amount: '99.95'
- compare_at_amount:
- thumbnail_url:
- option_values:
- - id: optval_UkLWZg9DAJ
- option_type_id: opt_UkLWZg9DAJ
name: size-15
label: S
position: 1
@@ -18323,6 +18220,233 @@ paths:
catalog_name:
cost_price: '17.00'
tax_category_id: taxcat_UkLWZg9DAJ
+ requestBody:
+ content:
+ application/json:
+ schema:
+ "$ref": "#/components/schemas/LineItemCreateParams"
+ required: true
+ "/api/v3/admin/orders/{order_id}/items/{id}":
+ get:
+ summary: Show an item
+ tags:
+ - Orders
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns details of a specific line item.
+
+ **Required scope:** `read_orders` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const item = await client.orders.items.get('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ')
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /orders/{order_id}/items/{id}
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ description: Bearer token for admin authentication
+ schema:
+ type: string
+ - name: order_id
+ in: path
+ required: true
+ description: Order ID
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ description: Item ID
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., variant, variant.product).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., quantity,price,total).
+ id is always included.
+ schema:
+ type: string
+ responses:
+ '200':
+ description: item found
+ content:
+ application/json:
+ example:
+ id: li_UkLWZg9DAJ
+ variant_id: variant_gbHJdmfrXB
+ seller_id:
+ preorder: false
+ preorder_ships_at:
+ quantity: 2
+ currency: USD
+ name: Product 802714
+ slug: product-802714
+ options_text: 'Size: S'
+ price: '10.00'
+ total: '20.00'
+ adjustment_total: '0.00'
+ additional_tax_total: '0.00'
+ included_tax_total: '0.00'
+ discount_total: '0.00'
+ pre_tax_amount: '20.00'
+ discounted_amount: '20.00'
+ compare_at_amount:
+ thumbnail_url:
+ option_values:
+ - id: optval_UkLWZg9DAJ
+ option_type_id: opt_UkLWZg9DAJ
+ name: size-16
+ label: S
+ position: 1
+ color_code:
+ option_type_name: foo-size-26
+ option_type_label: Size
+ image_url:
+ metadata: {}
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ digital_links: []
+ external_references: {}
+ metadata: {}
+ price_source:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ catalog_price: '19.99'
+ price_list_id:
+ price_list_name:
+ catalog_id:
+ catalog_name:
+ cost_price: '17.00'
+ tax_category_id: taxcat_UkLWZg9DAJ
+ patch:
+ summary: Update an item
+ tags:
+ - Orders
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Updates an order item quantity or metadata.
+
+ **Required scope:** `write_orders` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const item = await client.orders.items.update('or_UkLWZg9DAJ', 'li_UkLWZg9DAJ', {
+ quantity: 5,
+ })
+ - lang: bash
+ label: Spree CLI
+ source: spree api patch /orders/{order_id}/items/{id} -d '{"quantity":5}'
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ description: Bearer token for admin authentication
+ schema:
+ type: string
+ - name: order_id
+ in: path
+ required: true
+ description: Order ID
+ schema:
+ type: string
+ - name: id
+ in: path
+ required: true
+ description: Item ID
+ schema:
+ type: string
+ responses:
+ '200':
+ description: item updated
+ content:
+ application/json:
+ example:
+ id: li_UkLWZg9DAJ
+ variant_id: variant_gbHJdmfrXB
+ seller_id:
+ preorder: false
+ preorder_ships_at:
+ quantity: 5
+ currency: USD
+ name: Product 819758
+ slug: product-819758
+ options_text: 'Size: S'
+ price: '19.99'
+ total: '99.95'
+ adjustment_total: '0.00'
+ additional_tax_total: '0.00'
+ included_tax_total: '0.00'
+ discount_total: '0.00'
+ pre_tax_amount: '99.95'
+ discounted_amount: '99.95'
+ compare_at_amount:
+ thumbnail_url:
+ option_values:
+ - id: optval_UkLWZg9DAJ
+ option_type_id: opt_UkLWZg9DAJ
+ name: size-17
+ label: S
+ position: 1
+ color_code:
+ option_type_name: foo-size-27
+ option_type_label: Size
+ image_url:
+ metadata: {}
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ digital_links: []
+ external_references: {}
+ metadata: {}
+ price_source:
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ catalog_price: '19.99'
+ price_list_id:
+ price_list_name:
+ catalog_id:
+ catalog_name:
+ cost_price: '17.00'
+ tax_category_id: taxcat_UkLWZg9DAJ
requestBody:
content:
application/json:
@@ -20477,7 +20601,7 @@ paths:
example:
error:
code: processing_error
- message: Only 1 of Product 1772493 can be returned
+ message: Only 1 of Product 1792493 can be returned
schema:
"$ref": "#/components/schemas/ErrorResponse"
requestBody:
@@ -20998,6 +21122,130 @@ paths:
required:
- data
- meta
+ "/api/v3/admin/payment_methods/{payment_method_id}/custom_fields":
+ get:
+ summary: List payment method custom fields
+ tags:
+ - Payment Methods
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the payment method's custom field values.
+
+ **Required scope:** `read_settings` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('payment_method', 'pm_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /payment_methods/{payment_method_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: payment_method_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/payment_methods":
get:
summary: List payment methods
@@ -21103,7 +21351,7 @@ paths:
example:
data:
- id: pm_UkLWZg9DAJ
- name: Check 2
+ name: Check 3
description:
type: check
session_required: false
@@ -21379,7 +21627,7 @@ paths:
application/json:
example:
id: pm_UkLWZg9DAJ
- name: Check 6
+ name: Check 7
description:
type: check
session_required: false
@@ -23716,7 +23964,7 @@ paths:
updated_at: '2026-01-15T12:00:00.000Z'
provider_type:
provider_name: File
- download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ0Z252N2l0MG55YnkwbHhkczg5Y2hteTd6aXlvIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cInRoaW5raW5nLWNhdC5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jyd0aGlua2luZy1jYXQuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--e42005e4c105e6f8094c921695292e20b969a0ad/thinking-cat.jpg
+ download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJ0Z252N2l0MG55YnkwbHhkczg5Y2hteTd6aXlvIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cInRoaW5raW5nLWNhdC5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jyd0aGlua2luZy1jYXQuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--ead0f2ac81a0f7ac756847931f8e1927ea68ba81/thinking-cat.jpg
effective_authorized_clicks: 5
effective_authorized_days: 7
meta:
@@ -23807,7 +24055,7 @@ paths:
updated_at: '2026-01-15T12:00:00.000Z'
provider_type:
provider_name: File
- download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJhOXR0cGNpbmxxbThvbmtlNHM1NmI2Y3gxMWVzIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cIm1hbnVhbC5wZGZcIjsgZmlsZW5hbWUqPVVURi04JydtYW51YWwucGRmIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--c9c18ad2443198da01ed71a0dc9284caacae4001/manual.pdf
+ download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiJhOXR0cGNpbmxxbThvbmtlNHM1NmI2Y3gxMWVzIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cIm1hbnVhbC5wZGZcIjsgZmlsZW5hbWUqPVVURi04JydtYW51YWwucGRmIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--73db409a7ac92c07e323ae2157b9daa88b6b8921/manual.pdf
effective_authorized_clicks: 5
effective_authorized_days: 30
schema:
@@ -23896,7 +24144,7 @@ paths:
updated_at: '2026-01-15T12:00:00.000Z'
provider_type:
provider_name: File
- download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIwZXp6d3IzMzE3ajRoem9kc3Awc2czN3EzMnhzIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cInRoaW5raW5nLWNhdC5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jyd0aGlua2luZy1jYXQuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--460229b26eb8f170248268466ab15eea32d07043/thinking-cat.jpg
+ download_url: http://www.example.com/rails/active_storage/disk/eyJfcmFpbHMiOnsiZGF0YSI6eyJrZXkiOiIwZXp6d3IzMzE3ajRoem9kc3Awc2czN3EzMnhzIiwiZGlzcG9zaXRpb24iOiJhdHRhY2htZW50OyBmaWxlbmFtZT1cInRoaW5raW5nLWNhdC5qcGdcIjsgZmlsZW5hbWUqPVVURi04Jyd0aGlua2luZy1jYXQuanBnIiwiY29udGVudF90eXBlIjoiaW1hZ2UvanBlZyIsInNlcnZpY2VfbmFtZSI6InRlc3QifSwiZXhwIjoiMjAyNi0wMS0xNVQxMjowNTowMC4wMDBaIiwicHVyIjoiYmxvYl9rZXkifX0=--d1a701884ca72f5d076bf8fe63cdd083f0bed7bd/thinking-cat.jpg
effective_authorized_clicks: 10
effective_authorized_days: 7
schema:
@@ -24264,8 +24512,8 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1276550
- slug: product-1276550
+ name: Product 1296550
+ slug: product-1296550
meta_title:
meta_description:
meta_keywords:
@@ -24543,8 +24791,8 @@ paths:
application/json:
example:
id: prod_UkLWZg9DAJ
- name: Product 1312061
- slug: product-1312061
+ name: Product 1332061
+ slug: product-1332061
meta_title:
meta_description:
meta_keywords:
@@ -24654,7 +24902,7 @@ paths:
example:
id: prod_UkLWZg9DAJ
name: Updated Name
- slug: product-1335339
+ slug: product-1355339
meta_title:
meta_description:
meta_keywords:
@@ -25462,8 +25710,8 @@ paths:
application/json:
example:
id: prod_gbHJdmfrXB
- name: Product 1518682
- slug: product-1518682
+ name: Product 1538682
+ slug: product-1538682
meta_title:
meta_description:
meta_keywords:
@@ -25584,8 +25832,8 @@ paths:
application/json:
example:
id: prod_gbHJdmfrXB
- name: Product 1544387
- slug: product-1544387
+ name: Product 1564387
+ slug: product-1564387
meta_title:
meta_description:
meta_keywords:
@@ -28209,6 +28457,130 @@ paths:
in: 2
previous:
next:
+ "/api/v3/admin/promotions/{promotion_id}/custom_fields":
+ get:
+ summary: List promotion custom fields
+ tags:
+ - Promotions
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the promotion's custom field values.
+
+ **Required scope:** `read_promotions` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('promotion', 'promo_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /promotions/{promotion_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: promotion_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/promotions/{promotion_id}/promotion_actions":
parameters:
- name: promotion_id
@@ -29739,6 +30111,254 @@ paths:
schema:
"$ref": "#/components/schemas/RefundCreateParams"
required: true
+ "/api/v3/admin/tax_rates/{tax_rate_id}/custom_fields":
+ get:
+ summary: List tax rate custom fields
+ tags:
+ - Settings
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the tax rate's custom field values.
+
+ **Required scope:** `read_settings` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('tax_rate', 'tax_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /tax_rates/{tax_rate_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: tax_rate_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/stores/{store_id}/custom_fields":
+ get:
+ summary: List store custom fields
+ tags:
+ - Settings
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the store's custom field values.
+
+ **Required scope:** `read_settings` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('store', 'store_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /stores/{store_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: store_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/locales":
get:
summary: List supported locales
@@ -33539,6 +34159,130 @@ paths:
responses:
'204':
description: stock location deleted
+ "/api/v3/admin/store_credits/{store_credit_id}/custom_fields":
+ get:
+ summary: List store credit custom fields
+ tags:
+ - Store Credits
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the store credit's custom field values.
+
+ **Required scope:** `read_store_credits` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('store_credit', 'credit_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /store_credits/{store_credit_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: store_credit_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/store_credits":
get:
summary: List store credits
@@ -34291,7 +35035,7 @@ paths:
data:
- id: variant_UkLWZg9DAJ
product_id: prod_UkLWZg9DAJ
- sku: SKU-281
+ sku: SKU-285
options_text: ''
track_inventory: true
media_count: 0
@@ -34346,11 +35090,11 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2126804
+ product_name: Product 2146804
delivery_profile_id: fp_UkLWZg9DAJ
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- sku: SKU-282
+ sku: SKU-286
options_text: 'Size: S'
track_inventory: true
media_count: 0
@@ -34385,11 +35129,11 @@ paths:
option_values:
- id: optval_UkLWZg9DAJ
option_type_id: opt_UkLWZg9DAJ
- name: size-68
+ name: size-70
label: S
position: 1
color_code:
- option_type_name: foo-size-78
+ option_type_name: foo-size-80
option_type_label: Size
image_url:
metadata: {}
@@ -34417,7 +35161,7 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2126804
+ product_name: Product 2146804
delivery_profile_id: fp_UkLWZg9DAJ
meta:
page: 1
@@ -34563,7 +35307,7 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2131771
+ product_name: Product 2151771
delivery_profile_id: fp_UkLWZg9DAJ
'422':
description: validation error
@@ -34575,7 +35319,7 @@ paths:
message: SKU has already been taken
details:
sku:
- - value: SKU-286
+ - value: SKU-290
code: taken
message: has already been taken
specific: false
@@ -34663,7 +35407,7 @@ paths:
example:
id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- sku: SKU-288
+ sku: SKU-292
options_text: 'Size: S'
track_inventory: true
media_count: 0
@@ -34698,11 +35442,11 @@ paths:
option_values:
- id: optval_UkLWZg9DAJ
option_type_id: opt_UkLWZg9DAJ
- name: size-71
+ name: size-73
label: S
position: 1
color_code:
- option_type_name: foo-size-81
+ option_type_name: foo-size-83
option_type_label: Size
image_url:
metadata: {}
@@ -34730,7 +35474,7 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2154025
+ product_name: Product 2174025
delivery_profile_id: fp_UkLWZg9DAJ
'404':
description: variant not found
@@ -34838,11 +35582,11 @@ paths:
option_values:
- id: optval_UkLWZg9DAJ
option_type_id: opt_UkLWZg9DAJ
- name: size-73
+ name: size-75
label: S
position: 1
color_code:
- option_type_name: foo-size-83
+ option_type_name: foo-size-85
option_type_label: Size
image_url:
metadata: {}
@@ -34870,7 +35614,7 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2175672
+ product_name: Product 2195672
delivery_profile_id: fp_UkLWZg9DAJ
requestBody:
content:
@@ -35161,7 +35905,7 @@ paths:
data:
- id: variant_UkLWZg9DAJ
product_id: prod_UkLWZg9DAJ
- sku: SKU-295
+ sku: SKU-299
options_text: ''
track_inventory: true
media_count: 0
@@ -35216,11 +35960,11 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2193647
+ product_name: Product 2213647
delivery_profile_id: fp_UkLWZg9DAJ
- id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- sku: SKU-296
+ sku: SKU-300
options_text: 'Size: S'
track_inventory: true
media_count: 0
@@ -35255,11 +35999,11 @@ paths:
option_values:
- id: optval_UkLWZg9DAJ
option_type_id: opt_UkLWZg9DAJ
- name: size-75
+ name: size-77
label: S
position: 1
color_code:
- option_type_name: foo-size-85
+ option_type_name: foo-size-87
option_type_label: Size
image_url:
metadata: {}
@@ -35287,7 +36031,7 @@ paths:
available_stock: 0
reserved_quantity: 0
total_on_hand: 0
- product_name: Product 2193647
+ product_name: Product 2213647
delivery_profile_id: fp_UkLWZg9DAJ
meta:
page: 1
@@ -42726,6 +43470,8 @@ paths:
name: Claims
- resource_type: collection
name: Collections
+ - resource_type: company
+ name: Companies
- resource_type: credit_card
name: Credit Cards
- resource_type: customer
@@ -42762,6 +43508,8 @@ paths:
name: Products
- resource_type: promotion
name: Promotions
+ - resource_type: purchase_order
+ name: Purchase Orders
- resource_type: refund
name: Refunds
- resource_type: return
@@ -43042,6 +43790,750 @@ paths:
required:
- data
- meta
+ "/api/v3/admin/stock_transfers/{stock_transfer_id}/custom_fields":
+ get:
+ summary: List stock transfer custom fields
+ tags:
+ - Stock Transfers
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the stock transfer's custom field values.
+
+ **Required scope:** `read_stock` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('stock_transfer', 'st_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /stock_transfers/{stock_transfer_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: stock_transfer_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/purchase_orders/{purchase_order_id}/custom_fields":
+ get:
+ summary: List purchase order custom fields
+ tags:
+ - Purchase Orders
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the purchase order's custom field values.
+
+ **Required scope:** `read_purchasing` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('purchase_order', 'po_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /purchase_orders/{purchase_order_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: purchase_order_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/companies/{company_id}/custom_fields":
+ get:
+ summary: List company custom fields
+ tags:
+ - Companies
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the company's custom field values.
+
+ **Required scope:** `read_customers` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('company', 'comp_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /companies/{company_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: company_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/delivery_methods/{delivery_method_id}/custom_fields":
+ get:
+ summary: List delivery method custom fields
+ tags:
+ - Delivery
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the delivery method's custom field values.
+
+ **Required scope:** `read_delivery_methods` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('delivery_method', 'dm_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /delivery_methods/{delivery_method_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: delivery_method_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/product_types/{product_type_id}/custom_fields":
+ get:
+ summary: List product type custom fields
+ tags:
+ - Product Types
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the product type's custom field values.
+
+ **Required scope:** `read_product_types` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('product_type', 'pt_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /product_types/{product_type_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: product_type_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
+ "/api/v3/admin/media/{medium_id}/custom_fields":
+ get:
+ summary: List media file custom fields
+ tags:
+ - Media
+ security:
+ - api_key: []
+ bearer_auth: []
+ description: |-
+ Returns the media file's custom field values.
+
+ **Required scope:** `read_media` (for API-key authentication).
+ x-codeSamples:
+ - lang: javascript
+ label: Spree Admin SDK
+ source: |-
+ import { createAdminClient } from '@spree/admin-sdk'
+
+ const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+ })
+
+ const { data: customFields } = await client.customFields('media', 'media_UkLWZg9DAJ').list()
+ - lang: bash
+ label: Spree CLI
+ source: spree api get /media/{medium_id}/custom_fields
+ parameters:
+ - name: x-spree-api-key
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: Authorization
+ in: header
+ required: true
+ schema:
+ type: string
+ - name: medium_id
+ in: path
+ required: true
+ schema:
+ type: string
+ - name: expand
+ in: query
+ required: false
+ description: Comma-separated associations to expand (e.g., custom_field_definition).
+ Use dot notation for nested expand (max 4 levels).
+ schema:
+ type: string
+ - name: fields
+ in: query
+ required: false
+ description: Comma-separated list of fields to include (e.g., key,value,namespace).
+ id is always included.
+ schema:
+ type: string
+ - name: q
+ in: query
+ required: false
+ style: deepObject
+ explode: true
+ schema:
+ type: object
+ additionalProperties: true
+ description: Attribute filters, as `q[<attribute>_<predicate>]=value`. See
+ Filters above for the list.
+ x-mint:
+ content: |-
+ ## Filters
+
+ Filter with `q[<attribute>_<predicate>]=value`, for example `q[created_at_eq]=…`. Send a list as `q[<attribute>_in][]=a&q[<attribute>_in][]=b`. [How filters work](/api-reference/admin-api/querying#which-filters-an-endpoint-accepts).
+
+ | Attribute | Kind | Predicates |
+ |---|---|---|
+ | `created_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+ | `id` | Prefixed ID | `eq` `not_eq` `in` `not_in` `null` `not_null` |
+ | `updated_at` | Date and time | `eq` `not_eq` `in` `not_in` `lt` `lteq` `gt` `gteq` `null` `not_null` |
+
+ **Sort by:** `created_at`, `id`, `updated_at`. Prefix a field with `-` to sort descending.
+ x-spree-filters:
+ table: CustomField
+ sortable:
+ - created_at
+ - id
+ - updated_at
+ responses:
+ '200':
+ description: custom fields found
+ content:
+ application/json:
+ example:
+ data:
+ - id: cf_UkLWZg9DAJ
+ label: Title
+ field_type: short_text
+ key: custom.title
+ value: wool
+ created_at: '2026-01-15T12:00:00.000Z'
+ updated_at: '2026-01-15T12:00:00.000Z'
+ storefront_visible: true
+ custom_field_definition_id: cfdef_UkLWZg9DAJ
+ meta:
+ page: 1
+ limit: 25
+ count: 1
+ pages: 1
+ from: 1
+ to: 1
+ in: 1
+ previous:
+ next:
+ schema:
+ type: object
+ properties:
+ data:
+ type: array
+ items:
+ "$ref": "#/components/schemas/CustomField"
+ meta:
+ "$ref": "#/components/schemas/PaginationMeta"
+ required:
+ - data
+ - meta
"/api/v3/admin/delivery_profiles":
get:
summary: List delivery profiles
@@ -43643,7 +45135,7 @@ paths:
data:
- id: dm_UkLWZg9DAJ
name: UPS Ground
- code: UPS_GROUND_10
+ code: UPS_GROUND_11
estimated_transit_business_days_min:
estimated_transit_business_days_max:
digital: false
@@ -43829,7 +45321,7 @@ paths:
example:
id: dm_UkLWZg9DAJ
name: UPS Express
- code: UPS_GROUND_11
+ code: UPS_GROUND_12
estimated_transit_business_days_min: 1
estimated_transit_business_days_max: 2
digital: false
@@ -45080,13 +46572,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45094,10 +46586,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
viewable_id: prod_UkLWZg9DAJ
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: product
meta:
@@ -45188,13 +46680,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/library-upload.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/library-upload.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/library-upload.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/library-upload.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/library-upload.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/library-upload.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/library-upload.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/library-upload.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/library-upload.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/library-upload.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/library-upload.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/library-upload.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/library-upload.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/library-upload.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45202,10 +46694,10 @@ paths:
filename: library-upload.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/library-upload.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MiwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--f52aea954c8b0c35d86e91416f4414376ea5c1ef
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/library-upload.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MiwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3b8702b07c49f5c3b0de775f88f23bfead0d5834
viewable_id:
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/library-upload.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/library-upload.jpg?disposition=attachment
metadata: {}
viewable_type:
schema:
@@ -45283,13 +46775,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45297,10 +46789,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
viewable_id: prod_UkLWZg9DAJ
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: product
schema:
@@ -45374,7 +46866,7 @@ paths:
example:
data:
- kind: media
- name: Product 393397
+ name: Product 413397
owner_type: product
owner_id: prod_UkLWZg9DAJ
field: attachment
@@ -45534,13 +47026,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45548,10 +47040,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
viewable_id: prod_UkLWZg9DAJ
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: product
meta:
@@ -45642,13 +47134,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45656,10 +47148,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
viewable_id: prod_gbHJdmfrXB
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: product
schema:
@@ -45749,13 +47241,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45763,10 +47255,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--37ea8559a3ea6e9f4877608b795389de5d0a2325
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MSwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3f8bec6f6c76d54da7993efa8940c4e929b71478
viewable_id: prod_UkLWZg9DAJ
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--ac7861aca8bb12054d2fd9cc61d77a69b65bfbf3/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MSwicHVyIjoiYmxvYl9pZCJ9fQ==--4aef6bb6c096b25410d225d848efa139fb02ef80/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: product
schema:
@@ -45918,13 +47410,13 @@ paths:
video_embed_url:
video_url:
poster_url:
- original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/thinking-cat.jpg
- mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--c7cabbf4f42ac8ba67d9a91d8296f41a60806a27/thinking-cat.jpg
- small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--2a76f6551b45153f6e6be558bc5934f5252e5d4b/thinking-cat.jpg
- medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--70f1b4b1d65bbac19c369f6514a14b2efae9b861/thinking-cat.jpg
- large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--ad2e7db00f46de1be1b1d802422591dc63cda389/thinking-cat.jpg
- xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--a86d6ae04dadfd78927fab23cc51648f9edd3775/thinking-cat.jpg
- og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--c0f594ef4e0298070899e42d661848fbdf32192b/thinking-cat.jpg
+ original_url: http://localhost:3000/rails/active_storage/blobs/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/thinking-cat.jpg
+ mini_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjgsMTI4XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--b7d4163e56d2e1c1224b82fcbf29c6d389418c35/thinking-cat.jpg
+ small_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyNTYsMjU2XSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--1e4e9e92ff0d575e068b03d2347f9e63c034c7f0/thinking-cat.jpg
+ medium_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls0MDAsNDAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--e3cb86219678c00b3174ca00c64f04641a1742a5/thinking-cat.jpg
+ large_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOls3MjAsNzIwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--5abf9aeeafa5e725cf201c0560614c9317e73c8c/thinking-cat.jpg
+ xlarge_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsyMDAwLDIwMDBdLCJzYXZlciI6eyJzdHJpcCI6dHJ1ZSwicXVhbGl0eSI6NzUsImxvc3NsZXNzIjpmYWxzZSwiYWxwaGFfcSI6ODUsInJlZHVjdGlvbl9lZmZvcnQiOjYsInNtYXJ0X3N1YnNhbXBsZSI6dHJ1ZX19LCJwdXIiOiJ2YXJpYXRpb24ifX0=--5db1bd36ac712fe3dc607583f4ab31ecdf3a1f21/thinking-cat.jpg
+ og_image_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2ZpbGwiOlsxMjAwLDYzMF0sInNhdmVyIjp7InN0cmlwIjp0cnVlLCJxdWFsaXR5Ijo3NSwibG9zc2xlc3MiOmZhbHNlLCJhbHBoYV9xIjo4NSwicmVkdWN0aW9uX2VmZm9ydCI6Niwic21hcnRfc3Vic2FtcGxlIjp0cnVlfX0sInB1ciI6InZhcmlhdGlvbiJ9fQ==--04f02fc0aba9c7fed646166193caa31a9a247344/thinking-cat.jpg
external_references: {}
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
@@ -45932,10 +47424,10 @@ paths:
filename: thinking-cat.jpg
content_type: image/jpeg
byte_size: 18090
- embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--28f76504c18451476e04c1b0194941f513805ebe/thinking-cat.jpg
- signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MiwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--f52aea954c8b0c35d86e91416f4414376ea5c1ef
+ embed_url: http://localhost:3000/rails/active_storage/representations/proxy/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/eyJfcmFpbHMiOnsiZGF0YSI6eyJmb3JtYXQiOiJ3ZWJwIiwicmVzaXplX3RvX2xpbWl0IjpbMTIwMCwxMjAwXSwic2F2ZXIiOnsic3RyaXAiOnRydWUsInF1YWxpdHkiOjc1LCJsb3NzbGVzcyI6ZmFsc2UsImFscGhhX3EiOjg1LCJyZWR1Y3Rpb25fZWZmb3J0Ijo2LCJzbWFydF9zdWJzYW1wbGUiOnRydWV9fSwicHVyIjoidmFyaWF0aW9uIn19--11e07b486f19a616a54cd5b6e644a9a09062da00/thinking-cat.jpg
+ signed_id: eyJfcmFpbHMiOnsiZGF0YSI6MiwiZXhwIjoiMjAyNi0wMS0xNlQxMjowMDowMC4wMDBaIiwicHVyIjoiYmxvYl9pZCJ9fQ==--3b8702b07c49f5c3b0de775f88f23bfead0d5834
viewable_id: variant_gbHJdmfrXB
- download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--0aa96b0c1672ab4a98f8d9aee1d20d5e590a630a/thinking-cat.jpg?disposition=attachment
+ download_url: http://localhost:3000/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsiZGF0YSI6MiwicHVyIjoiYmxvYl9pZCJ9fQ==--719bfa956a3578a33855c517211e1a484db6a78a/thinking-cat.jpg?disposition=attachment
metadata: {}
viewable_type: variant
meta:
@@ -48221,12 +49713,12 @@ paths:
example:
data:
- id: prod_UkLWZg9DAJ
- name: Product 1063365
+ name: Product 1083365
thumbnail_url:
price_list_variants:
- id: variant_UkLWZg9DAJ
label:
- sku: SKU-123
+ sku: SKU-127
currency: USD
source: base
break_count: 1
@@ -49281,15 +50773,15 @@ paths:
purchase_order_id: po_UkLWZg9DAJ
variant_id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- variant_name: Product 1619018
- variant_sku: SKU-194
+ variant_name: Product 1639018
+ variant_sku: SKU-198
options_text: 'Size: S'
thumbnail_url:
supplier:
id: sup_UkLWZg9DAJ
name: Acme Wholesale
contact_name: Dana Okafor
phone: 555-0100
notes:
address1:
@@ -53333,8 +54825,8 @@ paths:
reserved_count: 0
incoming_count: 0
purchasable_count: 0
- variant_name: Product 1865410
- variant_sku: SKU-229
+ variant_name: Product 1885410
+ variant_sku: SKU-233
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
stock_location_name: Jong Schamberger
@@ -53353,8 +54845,8 @@ paths:
reserved_count: 0
incoming_count: 0
purchasable_count: 0
- variant_name: Product 1865410
- variant_sku: SKU-230
+ variant_name: Product 1885410
+ variant_sku: SKU-234
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
stock_location_name: Jong Schamberger
@@ -53373,8 +54865,8 @@ paths:
reserved_count: 2
incoming_count: 20
purchasable_count: 35
- variant_name: Product 1865410
- variant_sku: SKU-230
+ variant_name: Product 1885410
+ variant_sku: SKU-234
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
stock_location_name: Pilar Stokes
@@ -53558,8 +55050,8 @@ paths:
reserved_count: 0
incoming_count: 0
purchasable_count: 25
- variant_name: Product 1899378
- variant_sku: SKU-236
+ variant_name: Product 1919378
+ variant_sku: SKU-240
created_at: '2026-01-15T12:00:00.000Z'
updated_at: '2026-01-15T12:00:00.000Z'
stock_location_name: Gilbert Marquardt
@@ -53737,8 +55229,8 @@ paths:
stock_location_id: sloc_UkLWZg9DAJ
stock_location_name: Mona Hegmann
variant_id: variant_gbHJdmfrXB
- variant_name: Product 1908513
- variant_sku: SKU-237
+ variant_name: Product 1928513
+ variant_sku: SKU-241
order_id:
fulfillment_id:
return_id:
@@ -53852,8 +55344,8 @@ paths:
stock_location_id: sloc_UkLWZg9DAJ
stock_location_name: Chrystal Sauer
variant_id: variant_gbHJdmfrXB
- variant_name: Product 1922954
- variant_sku: SKU-241
+ variant_name: Product 1942954
+ variant_sku: SKU-245
order_id:
fulfillment_id:
return_id:
@@ -54444,8 +55936,8 @@ paths:
stock_transfer_id: st_UkLWZg9DAJ
variant_id: variant_gbHJdmfrXB
product_id: prod_UkLWZg9DAJ
- variant_name: Product 1992176
- variant_sku: SKU-254
+ variant_name: Product 2012176
+ variant_sku: SKU-258
options_text: 'Size: S'
thumbnail_url:
source_location:
@@ -55428,7 +56920,7 @@ paths:
- id: sup_UkLWZg9DAJ
name: Acme Wholesale
contact_name: Dana Okafor
phone: 555-0100
notes:
address1: 1 Warehouse Way
@@ -55624,7 +57116,7 @@ paths:
id: sup_UkLWZg9DAJ
name: Acme Wholesale
contact_name: Dana Okafor
phone: 555-0100
notes:
address1: 1 Warehouse Way
@@ -55701,7 +57193,7 @@ paths:
id: sup_UkLWZg9DAJ
name: Acme Wholesale
contact_name: Sam Reyes
phone: 555-0100
notes:
address1: 1 Warehouse Way
diff --git a/docs/developer/core-concepts/metafields.mdx b/docs/developer/core-concepts/metafields.mdx
index f80ade1f7e..c3c26665f3 100644
--- a/docs/developer/core-concepts/metafields.mdx
+++ b/docs/developer/core-concepts/metafields.mdx
@@ -197,7 +197,35 @@ In the dashboard, fields with these flags become available in the product table'
## What can carry custom fields
-Most things you'd want to annotate: products, variants, orders, line items, customers, categories, payments, fulfillments, gift cards and store credits, among others.
+Most things you'd want to annotate: products, variants, orders, line items, customers, categories, payments, fulfillments, gift cards and store credits, among others. **Settings → Custom Fields** lists every type your installation supports; types no dashboard screen edits appear under **Through the API only**, for integrations to fill in.
+
+Merchants fill values in from the record's own screen in the dashboard:
+
+| Where | Records | How values save |
+|---|---|---|
+| Detail page | Products, categories, collections, promotions, store settings | With the page's Save button |
+| Detail page | Orders, customers, companies, sellers, stock transfers, purchase orders | With the card's own Edit and Save |
+| Edit sheet | Option types, product types, tax rates, payment methods, delivery methods, gift cards, media | With the sheet's Save button |
+| Product page sheet | Variants, product media | With the sheet's Done (Cancel discards) |
+| Detail sheet | Store credits | With the card's own Edit and Save |
+
+Sheets show the card only once the store defines a field for that type, so a store that uses none sees no empty sections. Staff who can view a record but not edit it don't see its custom fields: reading them needs edit access.
+
+Each record type in the table above has the same nested endpoint. The Admin SDK reaches any of them through one accessor, named by the record's type:
+
+<CodeGroup>
+
+```typescript Admin SDK
+const { data: customFields } = await adminClient
+ .customFields('stock_transfer', 'st_xxx')
+ .list()
+```
+
+```bash CLI
+spree api get /stock_transfers/st_xxx/custom_fields
+```
+
+</CodeGroup>
## Definitions belong to a store
diff --git a/docs/developer/dashboard/slots-catalog.mdx b/docs/developer/dashboard/slots-catalog.mdx
index bfada25196..4e20503a33 100644
--- a/docs/developer/dashboard/slots-catalog.mdx
+++ b/docs/developer/dashboard/slots-catalog.mdx
@@ -120,7 +120,7 @@ On host-form pages your widget renders inside the page's `<form>` element, so a
| Where | The media editor sheet on the product create and edit pages, below the built-in fields |
|---|---|
| Use | Fields stored on one media file — a photo credit, a license, a usage restriction |
-| Context | `{ productId, media, mediaIndex, fieldPrefix }` — `media` is the row's form values, `fieldPrefix` the row's path (`media.2`); `productId` is `undefined` while creating |
+| Context | `{ productId, media, mediaIndex, fieldPrefix, onSave }` — `media` is the row's form values, `fieldPrefix` the row's path (`media.2`); `productId` is `undefined` while creating; `onSave` works as in `product.variant.form_fields`. The dashboard's own custom fields card renders here |
| Host form | **Yes** — form key `product.media`. Bind inputs under `fieldPrefix` and register fields under `product.media` ([recipe](/developer/dashboard/recipes/custom-form-field#a-field-on-a-media-or-variant-row)) |
#### `product.media.actions`
@@ -136,7 +136,7 @@ On host-form pages your widget renders inside the page's `<form>` element, so a
| Where | The variant editor sheet on the product create and edit pages, after the Tax section |
|---|---|
| Use | Fields stored on one variant — a supplier code, a fulfillment flag, a per-variant certification |
-| Context | `{ variant, variantIndex, fieldPrefix }` — `variant` is the row's form values, `fieldPrefix` the row's path (`variants.0`) |
+| Context | `{ variant, variantIndex, fieldPrefix, onSave }` — `variant` is the row's form values, `fieldPrefix` the row's path (`variants.0`); `onSave(handler)` registers an async function the sheet runs on Done, which keeps the sheet open when it resolves `false`, and returns an unregister function. A widget that writes its own record (as the dashboard's custom fields card does) saves it through `onSave`, so Done keeps it and Cancel drops it |
| Host form | **Yes** — form key `product.variant`. Bind inputs under `fieldPrefix` and register fields under `product.variant` |
#### `media.form_fields`
diff --git a/packages/admin-sdk/examples/company-custom-fields/list.ts b/packages/admin-sdk/examples/company-custom-fields/list.ts
new file mode 100644
index 0000000000..1dbb8169ea
--- /dev/null
+++ b/packages/admin-sdk/examples/company-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('company', 'comp_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/delivery-method-custom-fields/list.ts b/packages/admin-sdk/examples/delivery-method-custom-fields/list.ts
new file mode 100644
index 0000000000..8a9be9f955
--- /dev/null
+++ b/packages/admin-sdk/examples/delivery-method-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('delivery_method', 'dm_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/gift-card-custom-fields/list.ts b/packages/admin-sdk/examples/gift-card-custom-fields/list.ts
new file mode 100644
index 0000000000..8069e70b6b
--- /dev/null
+++ b/packages/admin-sdk/examples/gift-card-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('gift_card', 'gc_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/medium-custom-fields/list.ts b/packages/admin-sdk/examples/medium-custom-fields/list.ts
new file mode 100644
index 0000000000..4ba188676c
--- /dev/null
+++ b/packages/admin-sdk/examples/medium-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('media', 'media_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/payment-method-custom-fields/list.ts b/packages/admin-sdk/examples/payment-method-custom-fields/list.ts
new file mode 100644
index 0000000000..a7f7e8f97d
--- /dev/null
+++ b/packages/admin-sdk/examples/payment-method-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('payment_method', 'pm_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/product-type-custom-fields/list.ts b/packages/admin-sdk/examples/product-type-custom-fields/list.ts
new file mode 100644
index 0000000000..1e56c3aae4
--- /dev/null
+++ b/packages/admin-sdk/examples/product-type-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('product_type', 'pt_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/promotion-custom-fields/list.ts b/packages/admin-sdk/examples/promotion-custom-fields/list.ts
new file mode 100644
index 0000000000..b601995096
--- /dev/null
+++ b/packages/admin-sdk/examples/promotion-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('promotion', 'promo_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/purchase-order-custom-fields/list.ts b/packages/admin-sdk/examples/purchase-order-custom-fields/list.ts
new file mode 100644
index 0000000000..1ec0d9244a
--- /dev/null
+++ b/packages/admin-sdk/examples/purchase-order-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('purchase_order', 'po_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/stock-transfer-custom-fields/list.ts b/packages/admin-sdk/examples/stock-transfer-custom-fields/list.ts
new file mode 100644
index 0000000000..6b8df8591d
--- /dev/null
+++ b/packages/admin-sdk/examples/stock-transfer-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('stock_transfer', 'st_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/store-credit-custom-fields/list.ts b/packages/admin-sdk/examples/store-credit-custom-fields/list.ts
new file mode 100644
index 0000000000..badc8d143b
--- /dev/null
+++ b/packages/admin-sdk/examples/store-credit-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('store_credit', 'credit_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/store-custom-fields/list.ts b/packages/admin-sdk/examples/store-custom-fields/list.ts
new file mode 100644
index 0000000000..cc90e41730
--- /dev/null
+++ b/packages/admin-sdk/examples/store-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('store', 'store_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/examples/tax-rate-custom-fields/list.ts b/packages/admin-sdk/examples/tax-rate-custom-fields/list.ts
new file mode 100644
index 0000000000..2d76f19581
--- /dev/null
+++ b/packages/admin-sdk/examples/tax-rate-custom-fields/list.ts
@@ -0,0 +1,13 @@
+import { createAdminClient } from '@spree/admin-sdk'
+
+const client = createAdminClient({
+ baseUrl: 'https://your-store.com',
+ secretKey: 'sk_xxx',
+})
+
+// region:example
+const { data: customFields } = await client.customFields('tax_rate', 'tax_UkLWZg9DAJ').list()
+
+// endregion:example
+
+export { customFields }
diff --git a/packages/admin-sdk/src/admin-client.ts b/packages/admin-sdk/src/admin-client.ts
index a4737589f4..9dcfda5339 100644
--- a/packages/admin-sdk/src/admin-client.ts
+++ b/packages/admin-sdk/src/admin-client.ts
@@ -771,6 +771,18 @@ const CUSTOM_FIELD_OWNER_PATHS = {
collection: '/collections',
option_type: '/option_types',
seller: '/sellers',
+ promotion: '/promotions',
+ gift_card: '/gift_cards',
+ store_credit: '/store_credits',
+ stock_transfer: '/stock_transfers',
+ purchase_order: '/purchase_orders',
+ company: '/companies',
+ payment_method: '/payment_methods',
+ delivery_method: '/delivery_methods',
+ tax_rate: '/tax_rates',
+ product_type: '/product_types',
+ media: '/media',
+ store: '/stores',
} as const satisfies Record<Exclude<CustomFieldOwnerType, string & {}>, string>
export class AdminClient {
diff --git a/packages/admin-sdk/src/params.ts b/packages/admin-sdk/src/params.ts
index d4df60f0e3..9c47939340 100644
--- a/packages/admin-sdk/src/params.ts
+++ b/packages/admin-sdk/src/params.ts
@@ -404,9 +404,10 @@ export type ImportMappingParam = NonNullable<ImportCompleteMappingParams['mappin
/**
* Owner type passed to the generic `client.customFields(ownerType, ownerId)`
- * escape hatch. The first-class seven (products, variants, orders, customers,
- * categories, collections, option_types) have dedicated
- * `client.<resource>.customFields` accessors and don't need this.
+ * accessor. Products, variants, orders, customers, categories, collections,
+ * option types and sellers also have a dedicated
+ * `client.<resource>.customFields` accessor. A `store` owner is addressed by
+ * the current store's id.
*/
export type CustomFieldOwnerType =
| 'product'
@@ -417,6 +418,18 @@ export type CustomFieldOwnerType =
| 'collection'
| 'option_type'
| 'seller'
+ | 'promotion'
+ | 'gift_card'
+ | 'store_credit'
+ | 'stock_transfer'
+ | 'purchase_order'
+ | 'company'
+ | 'payment_method'
+ | 'delivery_method'
+ | 'tax_rate'
+ | 'product_type'
+ | 'media'
+ | 'store'
| (string & {})
export type PromotionKind = 'coupon_code' | 'automatic'
diff --git a/packages/admin-sdk/tests/custom-fields.test.ts b/packages/admin-sdk/tests/custom-fields.test.ts
index 151cb27dab..3c9c53f9ad 100644
--- a/packages/admin-sdk/tests/custom-fields.test.ts
+++ b/packages/admin-sdk/tests/custom-fields.test.ts
@@ -115,6 +115,12 @@ describe('custom fields', () => {
expect(echoed).toEqual({ parent: 'customers', parent_id: 'cus_1' })
})
+ it('routes the store to /stores', async () => {
+ const result = await client.customFields('store', 'store_1').list()
+ const echoed = (result.data[0] as { _route?: { parent: string; parent_id: string } })._route
+ expect(echoed).toEqual({ parent: 'stores', parent_id: 'store_1' })
+ })
+
it('supports CRUD via the curried accessor', async () => {
const accessor = client.customFields('order', 'or_1')
diff --git a/packages/admin-sdk/tests/mocks/handlers.ts b/packages/admin-sdk/tests/mocks/handlers.ts
index 75d91f3663..5412a3e7cb 100644
--- a/packages/admin-sdk/tests/mocks/handlers.ts
+++ b/packages/admin-sdk/tests/mocks/handlers.ts
@@ -39,6 +39,7 @@ const PARENT_PATHS = [
'categories',
'option_types',
'sellers',
+ 'stores',
] as const
// Echo the matched route segment + parent ID into the response under `_route`
diff --git a/packages/dashboard-core/src/index.ts b/packages/dashboard-core/src/index.ts
index 221e166e0b..cdb4387abb 100644
--- a/packages/dashboard-core/src/index.ts
+++ b/packages/dashboard-core/src/index.ts
@@ -140,6 +140,7 @@ export * from './products/product-form-cards'
export * from './products/product-form-mapping'
export * from './products/product-schema'
export * from './products/product-types'
+export type { SheetSaveHandler } from './products/sheet-save-handlers'
export * from './products/use-product-form-data'
export * from './products/variants-matrix'
export * from './products/video-url'
diff --git a/packages/dashboard-core/src/products/media-edit-sheet.tsx b/packages/dashboard-core/src/products/media-edit-sheet.tsx
index 2cdabe1c12..0f90b2fb0d 100644
--- a/packages/dashboard-core/src/products/media-edit-sheet.tsx
+++ b/packages/dashboard-core/src/products/media-edit-sheet.tsx
@@ -24,6 +24,7 @@ import i18n from 'i18next'
import { useCallback, useEffect, useRef } from 'react'
import type { UseFormReturn } from 'react-hook-form'
import type { PanelVariant as Variant } from './product-types'
+import { useSheetSaveHandlers } from './sheet-save-handlers'
// The fields this sheet edits. Snapshot, cancel-restore and the type all derive
// from this one list, so a new editable field can't reach the form and then be
@@ -52,8 +53,9 @@ interface Props {
// Form-backed media editor. The sheet edits `form.media[index]` directly —
// changes ride the parent product PATCH/POST, no per-asset API calls.
-// Cancel restores a snapshot taken on open; Done closes (parent form Save
-// commits). Same model as the per-variant Sheet.
+// Cancel restores a snapshot taken on open; Done runs the slot widgets' own
+// saves, then closes (parent form Save commits). Same model as the per-variant
+// Sheet.
export function MediaEditSheet({
form,
mediaIndex,
@@ -116,6 +118,8 @@ export function MediaEditSheet({
}
}, [open, mediaIndex, form, rowKey, formKey])
+ const { onSave, saveAll, saving } = useSheetSaveHandlers()
+
const entry = form.watch(`media.${mediaIndex}`)
if (!entry) return null
@@ -209,6 +213,8 @@ export function MediaEditSheet({
}
const handleCancel = () => {
+ // A save already sent can't be called back, so the sheet stays until it settles.
+ if (saving) return
const snap = snapshotRef.current
if (snap) {
// Resolve the row by stable key — the media array may have reordered
@@ -353,15 +359,22 @@ export function MediaEditSheet({
media: entry,
mediaIndex,
fieldPrefix: `media.${mediaIndex}`,
+ onSave,
}}
/>
</div>
<SheetFooter>
- <Button type="button" variant="outline" onClick={handleCancel}>
+ <Button type="button" variant="outline" disabled={saving} onClick={handleCancel}>
{t('admin.actions.cancel')}
</Button>
- <Button type="button" onClick={() => onOpenChange(false)}>
+ <Button
+ type="button"
+ disabled={saving}
+ onClick={async () => {
+ if (await saveAll()) onOpenChange(false)
+ }}
+ >
{t('admin.actions.done')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard-core/src/products/sheet-save-handlers.ts b/packages/dashboard-core/src/products/sheet-save-handlers.ts
new file mode 100644
index 0000000000..57e866600b
--- /dev/null
+++ b/packages/dashboard-core/src/products/sheet-save-handlers.ts
@@ -0,0 +1,37 @@
+import { useCallback, useRef, useState } from 'react'
+
+/** Persists a slot widget's own edits; resolves `false` to keep the sheet open. */
+export type SheetSaveHandler = () => Promise<boolean>
+
+/**
+ * Lets widgets in a product-page sheet's slot save their own records when the
+ * sheet's Done is pressed. The sheet's fields ride the product's Save, but a
+ * widget writing a different record (a variant's custom fields) has no other
+ * moment that matches what the merchant expects: Done keeps, Cancel drops.
+ */
+export function useSheetSaveHandlers() {
+ const handlers = useRef(new Set<SheetSaveHandler>())
+ const [saving, setSaving] = useState(false)
+
+ /** Registers a handler; the returned function unregisters it. */
+ const onSave = useCallback((handler: SheetSaveHandler) => {
+ handlers.current.add(handler)
+ return () => {
+ handlers.current.delete(handler)
+ }
+ }, [])
+
+ // A widget that throws keeps the sheet open like one that resolves `false`,
+ // rather than escaping as an unhandled rejection from the Done click.
+ const saveAll = useCallback(async () => {
+ setSaving(true)
+ try {
+ const results = await Promise.allSettled([...handlers.current].map((handler) => handler()))
+ return results.every((result) => result.status === 'fulfilled' && result.value)
+ } finally {
+ setSaving(false)
+ }
+ }, [])
+
+ return { onSave, saveAll, saving }
+}
diff --git a/packages/dashboard-core/src/products/variant-edit-sheet.tsx b/packages/dashboard-core/src/products/variant-edit-sheet.tsx
index 2b4ac4eb54..87f3298f91 100644
--- a/packages/dashboard-core/src/products/variant-edit-sheet.tsx
+++ b/packages/dashboard-core/src/products/variant-edit-sheet.tsx
@@ -37,6 +37,7 @@ import { useTenantId } from '../providers/tenant-provider'
import { cartonSize } from './carton-size'
import { normalizeCustomsDescription, normalizeHsCode } from './normalize-customs'
import { PURCHASE_UNITS } from './normalize-quantity'
+import { useSheetSaveHandlers } from './sheet-save-handlers'
import {
useFormCartonPackageTypes as useCartonPackageTypes,
useFormOptionTypes as useOptionTypes,
@@ -112,6 +113,8 @@ export function VariantEditSheet({ form, variantIndex, formKey, open, onOpenChan
: null
}, [open, variantIndex, form])
+ const { onSave, saveAll, saving } = useSheetSaveHandlers()
+
const variant = form.watch(`variants.${variantIndex}`)
if (!variant) return null
@@ -122,6 +125,8 @@ export function VariantEditSheet({ form, variantIndex, formKey, open, onOpenChan
)
const handleCancel = () => {
+ // A save already sent can't be called back, so the sheet stays until it settles.
+ if (saving) return
const snap = snapshotRef.current
if (snap) {
// Resolve the target index by stable id when we have one — the array
@@ -144,8 +149,8 @@ export function VariantEditSheet({ form, variantIndex, formKey, open, onOpenChan
onOpenChange(false)
}
- const handleDone = () => {
- onOpenChange(false)
+ const handleDone = async () => {
+ if (await saveAll()) onOpenChange(false)
}
return (
@@ -712,15 +717,15 @@ export function VariantEditSheet({ form, variantIndex, formKey, open, onOpenChan
<Slot
name={`${formKey}.variant.form_fields`}
- context={{ variant, variantIndex, fieldPrefix: `variants.${variantIndex}` }}
+ context={{ variant, variantIndex, fieldPrefix: `variants.${variantIndex}`, onSave }}
/>
</div>
<SheetFooter>
- <Button type="button" variant="outline" onClick={handleCancel}>
+ <Button type="button" variant="outline" disabled={saving} onClick={handleCancel}>
{t('admin.actions.cancel')}
</Button>
- <Button type="button" onClick={handleDone}>
+ <Button type="button" disabled={saving} onClick={handleDone}>
{t('admin.actions.done')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard-ui/src/spree/form-actions.tsx b/packages/dashboard-ui/src/spree/form-actions.tsx
index 584d4f0a6c..33360110b3 100644
--- a/packages/dashboard-ui/src/spree/form-actions.tsx
+++ b/packages/dashboard-ui/src/spree/form-actions.tsx
@@ -22,16 +22,22 @@ export function FormSaveButton<TFieldValues extends FieldValues>({
form,
label,
savingLabel,
+ dirty = false,
}: {
form: UseFormReturn<TFieldValues, any, any>
label?: string
savingLabel?: string
+ /**
+ * Unsaved changes held outside the form — custom field drafts the page
+ * saves from its own submit — counted as dirty alongside the form's own.
+ */
+ dirty?: boolean
}) {
const { t } = useTranslation()
const { isDirty, isSubmitting } = useFormState({ control: form.control })
return (
- <Button type="submit" disabled={!isDirty || isSubmitting}>
+ <Button type="submit" disabled={!(isDirty || dirty) || isSubmitting}>
{isSubmitting && <Loader2Icon className="animate-spin" />}
{isSubmitting
? (savingLabel ?? t('admin.actions.saving'))
@@ -52,15 +58,22 @@ export function FormDiscardButton<TFieldValues extends FieldValues>({
form,
label,
onDiscard,
+ dirty = false,
}: {
form: UseFormReturn<TFieldValues, any, any>
label?: string
onDiscard?: () => void
+ /**
+ * Unsaved changes held outside the form — custom field drafts the page
+ * saves from its own submit — counted as dirty alongside the form's own.
+ * Pass `onDiscard` too, so discarding drops them.
+ */
+ dirty?: boolean
}) {
const { t } = useTranslation()
const { isDirty, isSubmitting } = useFormState({ control: form.control })
- if (!isDirty) return null
+ if (!isDirty && !dirty) return null
return (
<Button
@@ -83,17 +96,23 @@ export function FormActions<TFieldValues extends FieldValues>({
savingLabel,
discardLabel,
onDiscard,
+ dirty,
}: {
form: UseFormReturn<TFieldValues, any, any>
saveLabel?: string
savingLabel?: string
discardLabel?: string
onDiscard?: () => void
+ /**
+ * Unsaved changes held outside the form — custom field drafts the page
+ * saves from its own submit — counted as dirty alongside the form's own.
+ */
+ dirty?: boolean
}) {
return (
<>
- <FormDiscardButton form={form} label={discardLabel} onDiscard={onDiscard} />
- <FormSaveButton form={form} label={saveLabel} savingLabel={savingLabel} />
+ <FormDiscardButton form={form} label={discardLabel} onDiscard={onDiscard} dirty={dirty} />
+ <FormSaveButton form={form} label={saveLabel} savingLabel={savingLabel} dirty={dirty} />
</>
)
}
@@ -113,8 +132,11 @@ export function FormActions<TFieldValues extends FieldValues>({
export function useFormSubmitShortcut<TFieldValues extends FieldValues>(
form: UseFormReturn<TFieldValues, any, any>,
onSubmit: (values: TFieldValues) => void | Promise<void>,
+ /** Unsaved changes held outside the form, as on `FormActions`. */
+ { dirty: externalDirty = false }: { dirty?: boolean } = {},
) {
- const { isDirty, isSubmitting } = useFormState({ control: form.control })
+ const { isDirty: formDirty, isSubmitting } = useFormState({ control: form.control })
+ const isDirty = formDirty || externalDirty
useHotkey(
'Mod+S',
diff --git a/packages/dashboard/e2e/companies.spec.ts b/packages/dashboard/e2e/companies.spec.ts
index c0a337105c..4a18b037fe 100644
--- a/packages/dashboard/e2e/companies.spec.ts
+++ b/packages/dashboard/e2e/companies.spec.ts
@@ -6,6 +6,8 @@ import {
login,
openRowMenu,
rowButton,
+ saveCustomFieldOnCard,
+ withCustomFieldDefinition,
} from './helpers'
const COMPANIES_PATH = (storeId: string) => `/${storeId}/companies`
@@ -280,4 +282,12 @@ test.describe('companies', () => {
await expect(rowButton(page, name)).toHaveCount(0, { timeout: 15_000 })
})
+
+ test('records a custom field on the company', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'company', async (label) => {
+ await createCompany(page, creds.store_id, `E2E Custom Field Co ${Date.now()}`)
+ await saveCustomFieldOnCard(page, label, 'Key account')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/custom-field-definitions.spec.ts b/packages/dashboard/e2e/custom-field-definitions.spec.ts
index ef52afac32..c3bb99bc8d 100644
--- a/packages/dashboard/e2e/custom-field-definitions.spec.ts
+++ b/packages/dashboard/e2e/custom-field-definitions.spec.ts
@@ -155,4 +155,26 @@ test.describe('custom field definitions', () => {
await page.reload()
await expect(customFields.getByText('Gold')).toBeVisible({ timeout: 15_000 })
})
+
+ // Types no dashboard screen edits stay definable for integrations, but the
+ // picker says so instead of implying a merchant can fill them in.
+ test('lists types without an edit screen apart, under their own heading', async ({ page }) => {
+ const creds = await login(page)
+ await gotoIndex(page, PATH(creds.store_id), CTA)
+
+ await page.getByRole('button', { name: CTA }).click()
+ await page.locator('#cfd-resource-type').click()
+
+ const listbox = page.getByRole('listbox')
+ await expect(listbox.getByRole('option', { name: /^stock transfers$/i })).toBeVisible()
+ await expect(listbox.getByText(/^through the api only$/i)).toBeVisible()
+ await expect(
+ listbox
+ .getByRole('group')
+ .filter({ hasText: /^through the api only/i })
+ .getByRole('option', {
+ name: /^line items$/i,
+ }),
+ ).toBeVisible()
+ })
})
diff --git a/packages/dashboard/e2e/customers.spec.ts b/packages/dashboard/e2e/customers.spec.ts
index 9999b2e3d2..832bcf5097 100644
--- a/packages/dashboard/e2e/customers.spec.ts
+++ b/packages/dashboard/e2e/customers.spec.ts
@@ -80,15 +80,12 @@ test.describe('customers', () => {
const email = `e2e-edit-${Date.now()}@example.com`
await createCustomer(page, email)
- // `<CardTitle>` renders as a `<div>` (not an `<h*>`), so we scope by text
- // and pick the first Edit button under it.
- const profileCard = page.locator('div').filter({
- has: page.getByText('Profile', { exact: true }),
- })
- await profileCard
- .getByRole('button', { name: /^edit$/i })
- .first()
- .click()
+ // Scoped to the Profile card itself: other cards on the page (custom
+ // fields, once a customer field is defined) carry an Edit button too.
+ const profileCard = page
+ .locator('[data-slot="card"]')
+ .filter({ has: page.locator('[data-slot="card-title"]', { hasText: /^Profile$/ }) })
+ await profileCard.getByRole('button', { name: /^edit$/i }).click()
await expect(page.getByRole('heading', { name: /^edit customer$/i })).toBeVisible()
await page.locator('#first_name').fill('Pat')
diff --git a/packages/dashboard/e2e/delivery-settings.spec.ts b/packages/dashboard/e2e/delivery-settings.spec.ts
index 4561d9c546..afa0477424 100644
--- a/packages/dashboard/e2e/delivery-settings.spec.ts
+++ b/packages/dashboard/e2e/delivery-settings.spec.ts
@@ -1,5 +1,12 @@
import { expect, type Locator, type Page, test } from '@playwright/test'
-import { FIXTURE_BULK_CHANNEL_NAME, gotoIndex, login } from './helpers'
+import {
+ adminRequest,
+ FIXTURE_BULK_CHANNEL_NAME,
+ gotoIndex,
+ login,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const DELIVERY_PROFILES_PATH = (storeId: string) => `/${storeId}/settings/delivery-profiles`
const PROFILE_CTA = /add profile/i
@@ -490,4 +497,20 @@ test.describe('delivery profiles', () => {
await expect(reopened.locator('#markup_percent')).toHaveValue('7.5')
await expect(reopened.locator('#markup_flat')).toHaveValue('2.50')
})
+
+ // An existing method: saving only a custom field leaves the method itself
+ // untouched, so the shared fixture stays as it was.
+ test('saves a custom field with the delivery method', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'delivery_method', async (label) => {
+ const methods = await adminRequest<{
+ data: { id: string; delivery_profile_id: string | null }[]
+ }>(page, creds, 'get', '/delivery_methods?limit=25')
+ const method = methods.data.find((candidate) => candidate.delivery_profile_id)
+ if (!method) throw new Error('no delivery method on a profile in the fixtures')
+ const url = `${DELIVERY_PROFILES_PATH(creds.store_id)}/${method.delivery_profile_id}?method=${method.id}`
+ await page.goto(url)
+ await saveCustomFieldInSheet(page, url, label, 'Carrier contract 12')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/gift-cards.spec.ts b/packages/dashboard/e2e/gift-cards.spec.ts
index 8c1cd57d0d..702bb22539 100644
--- a/packages/dashboard/e2e/gift-cards.spec.ts
+++ b/packages/dashboard/e2e/gift-cards.spec.ts
@@ -1,5 +1,13 @@
import { expect, type Page, test } from '@playwright/test'
-import { gotoIndex, login, openRowMenu, rowButton } from './helpers'
+import {
+ adminRequest,
+ gotoIndex,
+ login,
+ openRowMenu,
+ rowButton,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const GIFT_CARDS_PATH = (storeId: string) => `/${storeId}/loyalty/gift-cards`
const CTA = /new gift card/i
@@ -114,4 +122,17 @@ test.describe('gift cards', () => {
})
await expect(page.getByRole('heading', { name: /new gift card/i })).toBeVisible()
})
+
+ test('saves a custom field with the gift card', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'gift_card', async (label) => {
+ const giftCard = await adminRequest<{ id: string }>(page, creds, 'post', '/gift_cards', {
+ amount: '25.00',
+ currency: 'USD',
+ })
+ const url = `${GIFT_CARDS_PATH(creds.store_id)}?edit=${giftCard.id}`
+ await page.goto(url)
+ await saveCustomFieldInSheet(page, url, label, 'Holiday batch')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/helpers.ts b/packages/dashboard/e2e/helpers.ts
index da4656148f..ace4c83244 100644
--- a/packages/dashboard/e2e/helpers.ts
+++ b/packages/dashboard/e2e/helpers.ts
@@ -419,6 +419,119 @@ export async function fillAddressForm(page: Page, address: AddressInput) {
}
}
+/**
+ * Defines a short text custom field for one resource type and answers its
+ * id and label. Seeded through the API: defining fields has its own spec, and the
+ * specs calling this drive the record's own custom fields card.
+ */
+export async function createCustomFieldDefinition(
+ page: Page,
+ accessToken: string,
+ resourceType: string,
+): Promise<{ id: string; label: string }> {
+ const suffix = `${Date.now()}${Math.floor(Math.random() * 1000)}`
+ const label = `E2E ${resourceType} field ${suffix}`
+ const created = await page.request.post('/api/v3/admin/custom_field_definitions', {
+ headers: { Authorization: `Bearer ${accessToken}` },
+ data: {
+ namespace: 'e2e',
+ key: `field_${suffix}`,
+ label,
+ field_type: 'short_text',
+ resource_type: resourceType,
+ },
+ })
+ expect(created.status(), await created.text()).toBe(201)
+
+ return { id: (await created.json()).id as string, label }
+}
+
+/**
+ * Definitions are store-wide and outlive a spec, so one a sheet would render
+ * goes once the spec is done — a leftover field adds inputs other specs'
+ * selectors did not expect.
+ */
+export async function deleteCustomFieldDefinition(page: Page, accessToken: string, id: string) {
+ const res = await page.request.delete(`/api/v3/admin/custom_field_definitions/${id}`, {
+ headers: { Authorization: `Bearer ${accessToken}` },
+ })
+ expect(res.ok(), `DELETE custom_field_definitions/${id}: ${await res.text()}`).toBeTruthy()
+}
+
+/**
+ * Runs `test` with a short text custom field defined for `resourceType`, and
+ * deletes the definition afterwards however the test ends.
+ */
+export async function withCustomFieldDefinition(
+ page: Page,
+ session: E2ELoginSession,
+ resourceType: string,
+ test: (label: string) => Promise<void>,
+) {
+ const definition = await createCustomFieldDefinition(page, session.accessToken, resourceType)
+ try {
+ await test(definition.label)
+ } finally {
+ await deleteCustomFieldDefinition(page, session.accessToken, definition.id)
+ }
+}
+
+function customFieldsCardOn(page: Page) {
+ return page
+ .locator('[data-slot="card"]')
+ .filter({ has: page.locator('[data-slot="card-title"]', { hasText: /^Custom fields$/ }) })
+}
+
+/**
+ * Sets a value through a custom fields card that edits and saves itself (a
+ * detail page with no form of its own), and checks it survives a reload.
+ */
+export async function saveCustomFieldOnCard(page: Page, label: string, value: string) {
+ const card = customFieldsCardOn(page)
+ await card.getByRole('button', { name: /^edit$/i }).click()
+ await card.getByLabel(label).fill(value)
+ await card.getByRole('button', { name: /^save$/i }).click()
+ await expect(card.getByText(value)).toBeVisible({ timeout: 15_000 })
+
+ await page.reload()
+ await expect(customFieldsCardOn(page).getByText(value)).toBeVisible({ timeout: 15_000 })
+}
+
+/**
+ * Sets a value on a page whose own Save also saves its custom fields, and
+ * checks it survives a reload. A custom field alone must enable that Save.
+ */
+export async function saveCustomFieldWithPage(page: Page, label: string, value: string) {
+ await page.getByLabel(label).fill(value)
+ const save = page.getByRole('button', { name: /^save$/i })
+ await save.click()
+ await expect(save).toBeDisabled({ timeout: 15_000 })
+
+ await page.reload()
+ await expect(page.getByLabel(label)).toHaveValue(value, { timeout: 15_000 })
+}
+
+/**
+ * Sets a value in the open edit sheet and saves it with the sheet's own Save,
+ * then reopens the sheet at `url` to check it stuck.
+ */
+export async function saveCustomFieldInSheet(
+ page: Page,
+ url: string,
+ label: string,
+ value: string,
+) {
+ const sheet = page.getByRole('dialog')
+ await sheet.getByLabel(label).fill(value)
+ await sheet.getByRole('button', { name: /^save$/i }).click()
+ await expect(sheet).toBeHidden({ timeout: 15_000 })
+ // Only the custom field changed, so the record's own save toast never fires.
+ await expect(page.getByText(/^custom fields saved$/i).first()).toBeVisible()
+
+ await page.goto(url)
+ await expect(page.getByRole('dialog').getByLabel(label)).toHaveValue(value, { timeout: 15_000 })
+}
+
/**
* Opens a transfer of `quantity` units of `sku` from the fixture source
* warehouse to the fixture destination and marks it in transit, through the
diff --git a/packages/dashboard/e2e/media-library.spec.ts b/packages/dashboard/e2e/media-library.spec.ts
index ccfaa2816c..0247e0992d 100644
--- a/packages/dashboard/e2e/media-library.spec.ts
+++ b/packages/dashboard/e2e/media-library.spec.ts
@@ -1,7 +1,7 @@
import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { expect, type Page, type Route, test } from '@playwright/test'
-import { gotoIndex, login } from './helpers'
+import { gotoIndex, login, withCustomFieldDefinition } from './helpers'
import { E2E_DIR } from './paths'
import { createProduct, mediaCard, PRODUCTS_PATH } from './products-helpers'
@@ -236,4 +236,27 @@ test.describe('media library', () => {
timeout: 15_000,
})
})
+
+ test('saves a custom field with the file, beside its alt text', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'media', async (label) => {
+ await page.goto(MEDIA_PATH(creds.store_id))
+ await expect(page.getByRole('heading', { name: /^media$/i })).toBeVisible({ timeout: 15_000 })
+ const name = `e2e-custom-field-${Date.now()}.png`
+ await uploadImage(page, name)
+
+ await (await findTile(page, name)).click()
+ const sheet = page.getByRole('dialog')
+ await sheet.getByLabel(label).fill('Licensed until 2027')
+ await sheet.getByRole('button', { name: /^save$/i }).click()
+ await expect(page.getByText(/^saved$/i).first()).toBeVisible({ timeout: 15_000 })
+ await sheet.getByRole('button', { name: /^cancel$/i }).click()
+
+ await page.reload()
+ await (await findTile(page, name)).click()
+ await expect(page.getByRole('dialog').getByLabel(label)).toHaveValue('Licensed until 2027', {
+ timeout: 15_000,
+ })
+ })
+ })
})
diff --git a/packages/dashboard/e2e/option-types.spec.ts b/packages/dashboard/e2e/option-types.spec.ts
index 8b5392ce23..6abb10a9a3 100644
--- a/packages/dashboard/e2e/option-types.spec.ts
+++ b/packages/dashboard/e2e/option-types.spec.ts
@@ -1,5 +1,13 @@
import { expect, type Page, test } from '@playwright/test'
-import { gotoIndex, login, openRowMenu, rowButton } from './helpers'
+import {
+ adminRequest,
+ gotoIndex,
+ login,
+ openRowMenu,
+ rowButton,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const OPTIONS_PATH = (storeId: string) => `/${storeId}/products/options`
const CTA = /add option type/i
@@ -116,4 +124,17 @@ test.describe('option types', () => {
await expect(rowButton(page, internalName)).toHaveCount(0, { timeout: 15_000 })
})
+
+ test('saves a custom field with the option type', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'option_type', async (label) => {
+ const optionType = await adminRequest<{ id: string }>(page, creds, 'post', '/option_types', {
+ name: `e2e-custom-field-${Date.now()}`,
+ label: 'E2E Custom Field Option',
+ })
+ const url = `${OPTIONS_PATH(creds.store_id)}?edit=${optionType.id}`
+ await page.goto(url)
+ await saveCustomFieldInSheet(page, url, label, 'Swatch')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/payment-methods.spec.ts b/packages/dashboard/e2e/payment-methods.spec.ts
index b1eb34fb2a..c75842cdf8 100644
--- a/packages/dashboard/e2e/payment-methods.spec.ts
+++ b/packages/dashboard/e2e/payment-methods.spec.ts
@@ -1,5 +1,13 @@
import { expect, type Page, test } from '@playwright/test'
-import { gotoIndex, login, openRowMenu, rowButton } from './helpers'
+import {
+ adminRequest,
+ gotoIndex,
+ login,
+ openRowMenu,
+ rowButton,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const PAYMENT_METHODS_PATH = (storeId: string) => `/${storeId}/settings/payment-methods`
const CTA = /add payment method/i
@@ -140,4 +148,21 @@ test.describe('payment methods', () => {
await expect(rowButton(page, updated)).toBeVisible({ timeout: 15_000 })
})
+
+ // An existing method: saving only a custom field leaves the method itself
+ // untouched, so the shared fixture stays as it was.
+ test('saves a custom field with the payment method', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'payment_method', async (label) => {
+ const methods = await adminRequest<{ data: { id: string }[] }>(
+ page,
+ creds,
+ 'get',
+ '/payment_methods?limit=1',
+ )
+ const url = `${PAYMENT_METHODS_PATH(creds.store_id)}?edit=${methods.data[0].id}`
+ await page.goto(url)
+ await saveCustomFieldInSheet(page, url, label, 'NET30')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/product-types.spec.ts b/packages/dashboard/e2e/product-types.spec.ts
index c1b6783d11..46d4022dc7 100644
--- a/packages/dashboard/e2e/product-types.spec.ts
+++ b/packages/dashboard/e2e/product-types.spec.ts
@@ -1,5 +1,12 @@
import { expect, test } from '@playwright/test'
-import { FIXTURE_PROMO_TAXON, gotoIndex, login } from './helpers'
+import {
+ adminRequest,
+ FIXTURE_PROMO_TAXON,
+ gotoIndex,
+ login,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const PATH = (storeId: string) => `/${storeId}/settings/product-types`
const CTA = /add product type/i
@@ -63,4 +70,22 @@ test.describe('product types', () => {
// Client-side validation keeps the sheet open with an error.
await expect(page.getByRole('heading', { name: /new product type/i })).toBeVisible()
})
+
+ test('saves a custom field with the product type', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'product_type', async (label) => {
+ const productType = await adminRequest<{ id: string }>(
+ page,
+ creds,
+ 'post',
+ '/product_types',
+ {
+ name: `E2E Custom Field Type ${Date.now()}`,
+ },
+ )
+ const url = `${PATH(creds.store_id)}?edit=${productType.id}`
+ await page.goto(url)
+ await saveCustomFieldInSheet(page, url, label, 'Apparel')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/products-edit-media-variants.spec.ts b/packages/dashboard/e2e/products-edit-media-variants.spec.ts
index 9e77923283..93fdeb5583 100644
--- a/packages/dashboard/e2e/products-edit-media-variants.spec.ts
+++ b/packages/dashboard/e2e/products-edit-media-variants.spec.ts
@@ -1,7 +1,7 @@
import * as path from 'node:path'
import { fileURLToPath } from 'node:url'
import { expect, test } from '@playwright/test'
-import { login } from './helpers'
+import { createCustomFieldDefinition, deleteCustomFieldDefinition, login } from './helpers'
import {
addOptionToVariants,
clickMediaThumbnailAction,
@@ -139,4 +139,43 @@ test.describe('edit product — media variant linking', () => {
await clickMediaThumbnailAction(media, 'edit')
await expect(sheet.getByLabel('Alt text')).toHaveValue(newAlt)
})
+
+ test('saves a custom field on a persisted image from the sheet', async ({ page }) => {
+ const creds = await login(page)
+ const definition = await createCustomFieldDefinition(page, creds.accessToken, 'media')
+
+ try {
+ await createProduct(page, creds.store_id, `E2E Media Custom Field ${Date.now()}`)
+ const media = mediaCard(page)
+ await media.locator('input[type="file"]').setInputFiles(FIXTURE_IMAGE)
+ await expect(media.locator('img[src]').first()).toBeVisible({ timeout: 15_000 })
+ await expect(media.locator('.animate-spin')).toHaveCount(0, { timeout: 15_000 })
+ // Only a saved file has an id to hang the value on.
+ await page.getByRole('button', { name: /save product/i }).click()
+ await expect(page.getByRole('button', { name: /save product/i })).toBeDisabled({
+ timeout: 30_000,
+ })
+ await page.reload()
+ await expect(media.locator('img[src]').first()).toBeVisible({ timeout: 30_000 })
+
+ // Done keeps the value, like the alt text beside it.
+ await clickMediaThumbnailAction(media, 'edit')
+ const sheet = page.getByRole('dialog')
+ await sheet.getByLabel(definition.label).fill('Studio shot')
+ await sheet.getByRole('button', { name: /^done$/i }).click()
+ await expect(page.getByRole('heading', { name: /^edit media$/i })).toBeHidden({
+ timeout: 15_000,
+ })
+
+ await page.reload()
+ await expect(media.locator('img[src]').first()).toBeVisible({ timeout: 30_000 })
+ await clickMediaThumbnailAction(media, 'edit')
+ await expect(page.getByRole('dialog').getByLabel(definition.label)).toHaveValue(
+ 'Studio shot',
+ { timeout: 15_000 },
+ )
+ } finally {
+ await deleteCustomFieldDefinition(page, creds.accessToken, definition.id)
+ }
+ })
})
diff --git a/packages/dashboard/e2e/products-variants.spec.ts b/packages/dashboard/e2e/products-variants.spec.ts
index b8e1c060b2..afae1a8804 100644
--- a/packages/dashboard/e2e/products-variants.spec.ts
+++ b/packages/dashboard/e2e/products-variants.spec.ts
@@ -1,5 +1,5 @@
import { expect, test } from '@playwright/test'
-import { login } from './helpers'
+import { createCustomFieldDefinition, deleteCustomFieldDefinition, login } from './helpers'
import {
addOptionToVariants,
createProduct,
@@ -179,4 +179,43 @@ test.describe('product variants', () => {
await expect(sheet).toBeHidden()
}
})
+
+ test('saves a custom field from the variant sheet', async ({ page }) => {
+ const creds = await login(page)
+ const definition = await createCustomFieldDefinition(page, creds.accessToken, 'variant')
+ const colorLabel = await seedOptionType(page, creds.store_id, 'color', ['red'])
+
+ try {
+ await createProduct(page, creds.store_id, `E2E Variant Custom Field ${Date.now()}`)
+ await addOptionToVariants(page, colorLabel, ['Red'])
+ // Only a saved variant has an id to hang the value on.
+ await page.getByRole('button', { name: /save product/i }).click()
+ await expect(page.getByRole('button', { name: /save product/i })).toBeDisabled({
+ timeout: 30_000,
+ })
+
+ // Edited like the rest of the sheet: Done keeps it, Cancel drops it.
+ const variantsCard = variantsCardLocator(page)
+ await variantsCard.getByRole('button', { name: /^edit .*\bred$/i }).click()
+ const sheet = page.getByRole('dialog')
+ await sheet.getByLabel(definition.label).fill('Matte')
+ await sheet.getByRole('button', { name: /^done$/i }).click()
+ await expect(sheet).toBeHidden({ timeout: 15_000 })
+
+ await page.reload()
+ await variantsCard.getByRole('button', { name: /^edit .*\bred$/i }).click()
+ const reopened = page.getByRole('dialog')
+ await expect(reopened.getByLabel(definition.label)).toHaveValue('Matte', { timeout: 15_000 })
+
+ await reopened.getByLabel(definition.label).fill('Gloss')
+ await reopened.getByRole('button', { name: /^cancel$/i }).click()
+ await page.reload()
+ await variantsCard.getByRole('button', { name: /^edit .*\bred$/i }).click()
+ await expect(page.getByRole('dialog').getByLabel(definition.label)).toHaveValue('Matte', {
+ timeout: 15_000,
+ })
+ } finally {
+ await deleteCustomFieldDefinition(page, creds.accessToken, definition.id)
+ }
+ })
})
diff --git a/packages/dashboard/e2e/promotions.spec.ts b/packages/dashboard/e2e/promotions.spec.ts
index 40646f15b9..a2b503f435 100644
--- a/packages/dashboard/e2e/promotions.spec.ts
+++ b/packages/dashboard/e2e/promotions.spec.ts
@@ -1,5 +1,6 @@
import { expect, type Page, test } from '@playwright/test'
import {
+ adminRequest,
FIXTURE_BULK_CHANNEL_NAME,
FIXTURE_PROMO_COUNTRY,
FIXTURE_PROMO_CUSTOMER_FIRST_NAME,
@@ -10,6 +11,8 @@ import {
gotoIndex,
login,
rowButton,
+ saveCustomFieldWithPage,
+ withCustomFieldDefinition,
} from './helpers'
async function startNewPromotion(page: Page, storeId: string, name: string) {
@@ -649,4 +652,16 @@ test.describe('promotions', () => {
})
await expect(rowButton(page, name)).toHaveCount(0, { timeout: 15_000 })
})
+
+ test('saves a promotion custom field with the page Save', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'promotion', async (label) => {
+ const promotion = await adminRequest<{ id: string }>(page, creds, 'post', '/promotions', {
+ name: `E2E Custom Field Promo ${Date.now()}`,
+ kind: 'automatic',
+ })
+ await page.goto(`${PROMOTIONS_PATH(creds.store_id)}/${promotion.id}`)
+ await saveCustomFieldWithPage(page, label, 'Spring campaign')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/purchase-orders.spec.ts b/packages/dashboard/e2e/purchase-orders.spec.ts
index 15c4c24058..b4dc008e59 100644
--- a/packages/dashboard/e2e/purchase-orders.spec.ts
+++ b/packages/dashboard/e2e/purchase-orders.spec.ts
@@ -7,6 +7,8 @@ import {
gotoIndex,
login,
openRowMenu,
+ saveCustomFieldOnCard,
+ withCustomFieldDefinition,
} from './helpers'
const PURCHASE_ORDERS_PATH = (storeId: string) => `/${storeId}/purchase-orders`
@@ -271,4 +273,13 @@ test.describe('purchase orders', () => {
timeout: 15_000,
})
})
+
+ test('records a custom field on the purchase order', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'purchase_order', async (label) => {
+ const purchaseOrder = await createPurchaseOrder(page, creds.accessToken, { quantity: 1 })
+ await openPurchaseOrder(page, creds.store_id, purchaseOrder)
+ await saveCustomFieldOnCard(page, label, 'Contract 2026-7')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/sellers.spec.ts b/packages/dashboard/e2e/sellers.spec.ts
index c86c41cdbe..9a25941e45 100644
--- a/packages/dashboard/e2e/sellers.spec.ts
+++ b/packages/dashboard/e2e/sellers.spec.ts
@@ -1,5 +1,12 @@
import { expect, type Page, test } from '@playwright/test'
-import { escapeRegex, gotoIndex, login, openRowMenu } from './helpers'
+import {
+ escapeRegex,
+ gotoIndex,
+ login,
+ openRowMenu,
+ saveCustomFieldOnCard,
+ withCustomFieldDefinition,
+} from './helpers'
const SELLERS_PATH = (storeId: string) => `/${storeId}/sellers`
const CTA = /add seller/i
@@ -194,4 +201,13 @@ test.describe('sellers', () => {
await expect(rowLink(page, name)).toHaveCount(0, { timeout: 15_000 })
})
+
+ test('records a custom field on the seller', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'seller', async (label) => {
+ await gotoIndex(page, SELLERS_PATH(creds.store_id), CTA)
+ await createSeller(page, `E2E Custom Field Seller ${Date.now()}`)
+ await saveCustomFieldOnCard(page, label, 'Tier A')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/stock-transfers.spec.ts b/packages/dashboard/e2e/stock-transfers.spec.ts
index a777d0ca09..d82745b527 100644
--- a/packages/dashboard/e2e/stock-transfers.spec.ts
+++ b/packages/dashboard/e2e/stock-transfers.spec.ts
@@ -7,6 +7,8 @@ import {
FIXTURE_TRANSFER_SOURCE,
gotoIndex,
login,
+ saveCustomFieldOnCard,
+ withCustomFieldDefinition,
} from './helpers'
const TRANSFERS_PATH = (storeId: string) => `/${storeId}/transfers`
@@ -89,6 +91,19 @@ test.describe('stock transfers', () => {
await expect(page.getByText(/no deliveries yet/i)).toBeVisible()
})
+ test('records a custom field on the transfer', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'stock_transfer', async (label) => {
+ const transfer = await createInTransitTransfer(page, creds.accessToken, {
+ sku: FIXTURE_TRANSFER_SKU,
+ quantity: 1,
+ })
+ await page.goto(`${TRANSFERS_PATH(creds.store_id)}/${transfer.id}`)
+ // A detail page with no form of its own: the card edits and saves itself.
+ await saveCustomFieldOnCard(page, label, 'Carrier TRK-42')
+ })
+ })
+
test('sends a draft, then counts in a delivery with damage', async ({ page }) => {
const creds = await login(page)
const transfer = await createInTransitTransfer(page, creds.accessToken, {
diff --git a/packages/dashboard/e2e/store-credits.spec.ts b/packages/dashboard/e2e/store-credits.spec.ts
index 9fa1b3a23d..7e73f46f5e 100644
--- a/packages/dashboard/e2e/store-credits.spec.ts
+++ b/packages/dashboard/e2e/store-credits.spec.ts
@@ -1,5 +1,12 @@
import { expect, type Page, test } from '@playwright/test'
-import { escapeRegex, FIXTURE_PROMO_CUSTOMER_EMAIL, login, openRowMenu } from './helpers'
+import {
+ escapeRegex,
+ FIXTURE_PROMO_CUSTOMER_EMAIL,
+ login,
+ openRowMenu,
+ saveCustomFieldOnCard,
+ withCustomFieldDefinition,
+} from './helpers'
const STORE_CREDITS_PATH = (storeId: string) => `/${storeId}/loyalty/store-credits`
@@ -17,6 +24,7 @@ async function issueStoreCredit(page: Page, accessToken: string, memo: string) {
{ headers, data: { amount: '40.00', currency: 'USD', memo } },
)
expect(created.status(), await created.text()).toBe(201)
+ return (await created.json()) as { id: string }
}
test.describe('store credits', () => {
@@ -137,4 +145,18 @@ test.describe('store credits', () => {
.click()
await expect(page.locator('tr').filter({ hasText: memo })).toHaveCount(0, { timeout: 15_000 })
})
+
+ test('records a custom field on a credit from its sheet', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'store_credit', async (label) => {
+ const credit = await issueStoreCredit(
+ page,
+ creds.accessToken,
+ `E2E custom field ${Date.now()}`,
+ )
+ await page.goto(`${STORE_CREDITS_PATH(creds.store_id)}?credit=${credit.id}`)
+ // A detail sheet with no form: the card edits and saves itself.
+ await saveCustomFieldOnCard(page, label, 'Goodwill')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/store-settings.spec.ts b/packages/dashboard/e2e/store-settings.spec.ts
index 98311aff95..c5f772b8e6 100644
--- a/packages/dashboard/e2e/store-settings.spec.ts
+++ b/packages/dashboard/e2e/store-settings.spec.ts
@@ -1,7 +1,12 @@
import * as path from 'node:path'
import { fileURLToPath } from 'node:url'
import { expect, test } from '@playwright/test'
-import { login, openProfileDialog } from './helpers'
+import {
+ login,
+ openProfileDialog,
+ saveCustomFieldWithPage,
+ withCustomFieldDefinition,
+} from './helpers'
const FIXTURE_IMAGE = path.join(
path.dirname(fileURLToPath(import.meta.url)),
@@ -361,4 +366,12 @@ test.describe('store settings — emails', () => {
await save.click()
await expect(save).toBeDisabled({ timeout: 15_000 })
})
+
+ test('saves a store custom field with the page Save', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'store', async (label) => {
+ await page.goto(STORE_PATH(creds.store_id))
+ await saveCustomFieldWithPage(page, label, 'Region EU')
+ })
+ })
})
diff --git a/packages/dashboard/e2e/tax-rates.spec.ts b/packages/dashboard/e2e/tax-rates.spec.ts
index 88759d6478..343cd670c3 100644
--- a/packages/dashboard/e2e/tax-rates.spec.ts
+++ b/packages/dashboard/e2e/tax-rates.spec.ts
@@ -1,5 +1,12 @@
import { expect, type Page, test } from '@playwright/test'
-import { gotoIndex, login, openRowMenu, rowButton } from './helpers'
+import {
+ gotoIndex,
+ login,
+ openRowMenu,
+ rowButton,
+ saveCustomFieldInSheet,
+ withCustomFieldDefinition,
+} from './helpers'
const TAX_RATES_PATH = (storeId: string) => `/${storeId}/settings/taxes/rates`
const CTA = /add tax rate/i
@@ -88,6 +95,21 @@ test.describe('tax rates', () => {
})
})
+ test('saves a custom field with the rate', async ({ page }) => {
+ const creds = await login(page)
+ await withCustomFieldDefinition(page, creds, 'tax_rate', async (label) => {
+ await gotoIndex(page, TAX_RATES_PATH(creds.store_id), CTA)
+ const name = `E2E Custom Field Rate ${Date.now()}`
+ await createTaxRate(page, { name, ratePercent: '5' })
+ await expect(rowButton(page, name)).toBeVisible({ timeout: 15_000 })
+
+ // The field rides on the sheet's own Save, like the rate's attributes.
+ await rowButton(page, name).click()
+ await expect(page.getByRole('dialog').getByLabel(label)).toBeVisible({ timeout: 15_000 })
+ await saveCustomFieldInSheet(page, page.url(), label, 'VAT-R5')
+ })
+ })
+
// The API stores the fraction (0.07125); the form must read back exactly
// what the merchant typed, not a rounded 7.13.
test('keeps a rate with three decimals exactly', async ({ page }) => {
diff --git a/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx b/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
index ad8a29c21a..9d4c51addb 100644
--- a/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/custom-fields-inline.tsx
@@ -1,16 +1,19 @@
-// Inline custom-fields editor — generic-context shape, two providers, two
+// Inline custom-fields editor — generic-context shape, three providers,
// predictable save modes (never on-blur). This is the single custom-fields
-// surface across the dashboard — products, categories, customers, orders.
+// surface across the dashboard.
//
// The card is purely presentational and reads everything from context. State
// and persistence are dependency-injected by the provider above it:
// - `FormBackedCustomFieldsProvider` keeps fields editable inline and writes
// into a parent page form's `custom_fields[]` (products, categories) — values
// persist only on that page's Save.
+// - `DraftCustomFieldsProvider` keeps fields editable inline and holds them in
+// a `useCustomFieldsDraft` the host form saves from its own submit (settings
+// sheets, promotions, store settings).
// - `EditableApiCustomFieldsProvider` shows a read-only display with an Edit
-// button (orders, customers) and batches changed fields to the
+// button (orders, customers, sellers) and batches changed fields to the
// /custom_fields endpoints on the card's own Save.
-// Neither persists on blur; the provider advertises its behaviour via `mode`.
+// None persists on blur; the provider advertises its behaviour via `mode`.
//
// The empty state opens a sheet to create the first definition in place; on
// success the sheet closes and the definitions query re-validates, so the card
@@ -19,7 +22,7 @@
// Composition refs:
// - state-context-interface: `{ state, actions, meta, mode }`
// - state-decouple-implementation: card never touches the form or the SDK
-// - patterns-explicit-variants: two named providers + a `mode` discriminator
+// - patterns-explicit-variants: named providers + a `mode` discriminator
import { zodResolver } from '@hookform/resolvers/zod'
import type { CustomField, CustomFieldDefinition, CustomFieldOwnerType } from '@spree/admin-sdk'
@@ -31,6 +34,7 @@ import {
useCreateCustomFieldDefinition,
useCustomFieldDefinitions,
useCustomFields,
+ usePermissions,
useUpdateCustomField,
} from '@spree/dashboard-core'
import {
@@ -110,6 +114,10 @@ interface CustomFieldsMeta {
* visual marker and nothing else.
*/
requiredDefinitionIds?: string[]
+ /** `false` hides the card: the endpoints need edit access even to read. */
+ canEdit?: boolean
+ /** The values did not load, so blank inputs would misstate what is saved. */
+ loadFailed?: boolean
}
/**
@@ -261,43 +269,64 @@ export function FormBackedCustomFieldsProvider<T extends CustomFieldsFormShape>(
}
// ---------------------------------------------------------------------------
-// Provider B: editable API-backed (display/edit mode).
-// Reads via `useCustomFields`. Default view is read-only; an explicit Edit
-// reveals inputs and a card-level Save batches all changed values to the API
-// (create or update per field, in parallel). No on-blur persistence — Save is
-// the only write. For pages with no page-wide form (orders, customers).
+// API-backed drafts. Holds edits until `save()` batches every changed value to
+// the /custom_fields endpoints (create or update per field, in parallel). Both
+// API-backed providers below are built on it; a host form whose own Save
+// should also persist custom fields (a settings sheet, a form page) calls
+// `save()` from its submit handler and reads `isDirty` to enable that button.
// ---------------------------------------------------------------------------
-interface EditableApiProviderProps {
+export interface CustomFieldsDraft {
ownerType: CustomFieldOwnerType
- ownerId: string
resourceType: string
- /** Plural, human-readable resource name for empty-state copy. */
- resourceLabel?: string
- children: ReactNode
+ definitions: CustomFieldDefinition[]
+ isLoading: boolean
+ canEdit: boolean
+ loadFailed: boolean
+ /** Persisted values with the unsaved edits applied, keyed by definition id. */
+ values: Record<string, unknown>
+ setValue: (definitionId: string, value: unknown) => void
+ isDirty: boolean
+ /** Drops the unsaved edits. */
+ reset: () => void
+ /**
+ * Persists the changed values. Resolves `true` when everything saved, and
+ * `false` after telling the user which fields did not — their edits are kept
+ * so a retry only re-sends the failures. `announce` confirms a successful
+ * save with a toast, for a host whose own record did not need saving (so its
+ * own success toast never fires).
+ */
+ save: (options?: { announce?: boolean }) => Promise<boolean>
}
-export function EditableApiCustomFieldsProvider({
- ownerType,
- ownerId,
- resourceType,
- resourceLabel,
- children,
-}: EditableApiProviderProps) {
+/**
+ * @param ownerId empty while the owner has not been created yet; nothing loads
+ * and `save()` is a no-op until it has an id.
+ */
+export function useCustomFieldsDraft(
+ ownerType: CustomFieldOwnerType,
+ ownerId: string,
+ resourceType: string = ownerType,
+): CustomFieldsDraft {
const { t } = useTranslation()
+ const { permissions } = usePermissions()
+ const canEdit = permissions.can('update', ownerType)
const { data: definitionsResponse, isLoading: defsLoading } =
useCustomFieldDefinitions(resourceType)
+ // Memoize against the fetched array's identity so consumers don't re-render
+ // (or re-run effects) on every render.
+ const definitions = useMemo(() => definitionsResponse?.data ?? [], [definitionsResponse?.data])
+ // No values to read without a field to hold them, nor without edit access.
+ const valuesOwnerId = canEdit && definitions.length > 0 ? ownerId : ''
const {
data: valuesResponse,
isLoading: valuesLoading,
+ isError: loadFailed,
refetch,
- } = useCustomFields(ownerType, ownerId)
+ } = useCustomFields(ownerType, valuesOwnerId)
const create = useCreateCustomField(ownerType, ownerId)
const update = useUpdateCustomField(ownerType, ownerId)
- // Memoize against the fetched array's identity so the seeding effect below
- // doesn't re-run every render (→ setState loop → "Maximum update depth").
- const definitions = useMemo(() => definitionsResponse?.data ?? [], [definitionsResponse?.data])
const savedValues = useMemo(() => valuesResponse?.data ?? [], [valuesResponse?.data])
// definition id → persisted CustomField record (for update-by-id + baseline).
@@ -307,140 +336,294 @@ export function EditableApiCustomFieldsProvider({
return out
}, [savedValues])
- // The display value for every definition is the persisted value (drafts only
- // exist while editing). Keyed by definition id so the card reads uniformly.
- const savedDraft = useMemo(() => {
+ const [drafts, setDrafts] = useState<Record<string, unknown>>({})
+
+ // A different owner (a sheet reused for the next row) starts clean.
+ const [draftOwnerId, setDraftOwnerId] = useState(ownerId)
+ if (draftOwnerId !== ownerId) {
+ setDraftOwnerId(ownerId)
+ setDrafts({})
+ }
+
+ const values = useMemo(() => {
const out: Record<string, unknown> = {}
savedByDefinitionId.forEach((cf, defId) => {
out[defId] = cf.value
})
- return out
- }, [savedByDefinitionId])
-
- const [isEditing, setIsEditing] = useState(false)
- const [saving, setSaving] = useState(false)
- // Drafts hold edits while in edit mode; null when not editing (display reads
- // the persisted values directly, always fresh after a save's refetch).
- const [drafts, setDrafts] = useState<Record<string, unknown> | null>(null)
-
- const values = isEditing && drafts ? drafts : savedDraft
+ return { ...out, ...drafts }
+ }, [savedByDefinitionId, drafts])
+
+ // One entry per definition whose draft differs from the persisted value.
+ const changedDefinitions = useMemo(
+ () =>
+ definitions.filter(
+ (def) =>
+ def.id in drafts && !valuesEqual(drafts[def.id], savedByDefinitionId.get(def.id)?.value),
+ ),
+ [definitions, drafts, savedByDefinitionId],
+ )
const setValue = useCallback((definitionId: string, value: unknown) => {
- setDrafts((prev) => ({ ...(prev ?? {}), [definitionId]: value }))
+ setDrafts((prev) => ({ ...prev, [definitionId]: value }))
}, [])
- const startEdit = useCallback(() => {
- setDrafts({ ...savedDraft })
- setIsEditing(true)
- }, [savedDraft])
+ const reset = useCallback(() => setDrafts({}), [])
- const cancel = useCallback(() => {
- setDrafts(null)
- setIsEditing(false)
- }, [])
+ const save = useCallback(
+ async ({ announce = false }: { announce?: boolean } = {}) => {
+ if (!ownerId || loadFailed || changedDefinitions.length === 0) {
+ setDrafts({})
+ return true
+ }
- const save = useCallback(async () => {
- const current = drafts ?? {}
- // One task per definition whose draft differs from the persisted value,
- // tagged with its definition so we can name failures back to the user.
- const tasks: { def: CustomFieldDefinition; run: () => Promise<unknown> }[] = []
- for (const def of definitions) {
- const draft = current[def.id]
- const existing = savedByDefinitionId.get(def.id)
- if (valuesEqual(draft, existing?.value)) continue
- tasks.push({
- def,
- run: existing
+ const tasks = changedDefinitions.map((def) => {
+ const draft = drafts[def.id]
+ const existing = savedByDefinitionId.get(def.id)
+ return existing
? () => update.mutateAsync({ id: existing.id, value: draft })
- : () => create.mutateAsync({ custom_field_definition_id: def.id, value: draft }),
+ : () => create.mutateAsync({ custom_field_definition_id: def.id, value: draft })
})
- }
- if (tasks.length === 0) {
+ try {
+ // allSettled (not all): a mid-batch failure must not orphan the fields
+ // that already persisted. Refetch unconditionally so the baseline matches
+ // the server, then report partial failures by field name.
+ const results = await Promise.allSettled(tasks.map((task) => task()))
+ await refetch()
+
+ const failed = changedDefinitions.filter((_, i) => results[i].status === 'rejected')
+ if (failed.length === 0) {
+ setDrafts({})
+ if (announce) {
+ toastManager.add({
+ type: 'success',
+ title: t('admin.components.custom_fields.values_saved'),
+ })
+ }
+ return true
+ }
+
+ toastManager.add({
+ type: 'error',
+ title: t('admin.components.custom_fields.values_save_partial_failed', {
+ fields: failed.map((def) => def.label || def.key).join(', '),
+ }),
+ })
+ return false
+ } catch (err) {
+ // refetch() itself failed (network) — the saves may still have landed.
+ const message =
+ err instanceof Error
+ ? err.message
+ : t('admin.components.custom_fields.errors.failed_to_save')
+ toastManager.add({ type: 'error', title: message })
+ return false
+ }
+ },
+ [
+ ownerId,
+ loadFailed,
+ changedDefinitions,
+ drafts,
+ savedByDefinitionId,
+ create,
+ update,
+ refetch,
+ t,
+ ],
+ )
+
+ return useMemo(
+ () => ({
+ ownerType,
+ resourceType,
+ definitions,
+ isLoading: defsLoading || (!!valuesOwnerId && valuesLoading),
+ canEdit,
+ loadFailed,
+ values,
+ setValue,
+ isDirty: changedDefinitions.length > 0,
+ reset,
+ save,
+ }),
+ [
+ ownerType,
+ resourceType,
+ definitions,
+ defsLoading,
+ valuesOwnerId,
+ valuesLoading,
+ canEdit,
+ loadFailed,
+ values,
+ setValue,
+ changedDefinitions,
+ reset,
+ save,
+ ],
+ )
+}
+
+// ---------------------------------------------------------------------------
+// Provider B: host-saved API drafts (mode `form`). Fields are always editable;
+// the host form's Save calls `draft.save()`. For settings sheets and form pages
+// whose owner has no `custom_fields` write of its own.
+// ---------------------------------------------------------------------------
+
+interface DraftProviderProps {
+ draft: CustomFieldsDraft
+ /** Plural, human-readable resource name for empty-state copy. */
+ resourceLabel?: string
+ children: ReactNode
+}
+
+export function DraftCustomFieldsProvider({ draft, resourceLabel, children }: DraftProviderProps) {
+ const ctx = useMemo<CustomFieldsContextValue>(
+ () => ({
+ state: { values: draft.values },
+ actions: { setValue: draft.setValue },
+ meta: {
+ definitions: draft.definitions,
+ isLoading: draft.isLoading,
+ resourceType: draft.resourceType,
+ resourceLabel,
+ canEdit: draft.canEdit,
+ loadFailed: draft.loadFailed,
+ },
+ mode: { kind: 'form' },
+ }),
+ [draft, resourceLabel],
+ )
+
+ return <CustomFieldsContext value={ctx}>{children}</CustomFieldsContext>
+}
+
+// ---------------------------------------------------------------------------
+// Provider C: editable API-backed (display/edit mode).
+// Default view is read-only; an explicit Edit reveals inputs and a card-level
+// Save batches all changed values. No on-blur persistence — Save is the only
+// write. For pages with no page-wide form (orders, customers).
+// ---------------------------------------------------------------------------
+
+interface EditableApiProviderProps {
+ ownerType: CustomFieldOwnerType
+ ownerId: string
+ resourceType: string
+ /** Plural, human-readable resource name for empty-state copy. */
+ resourceLabel?: string
+ children: ReactNode
+}
+
+export function EditableApiCustomFieldsProvider({
+ ownerType,
+ ownerId,
+ resourceType,
+ resourceLabel,
+ children,
+}: EditableApiProviderProps) {
+ const draft = useCustomFieldsDraft(ownerType, ownerId, resourceType)
+ const { reset, save: saveDraft } = draft
+
+ const [isEditing, setIsEditing] = useState(false)
+ const [saving, setSaving] = useState(false)
+
+ const startEdit = useCallback(() => setIsEditing(true), [])
+
+ const cancel = useCallback(() => {
+ reset()
+ setIsEditing(false)
+ }, [reset])
+
+ const save = useCallback(async () => {
+ if (!draft.isDirty) {
cancel()
return
}
setSaving(true)
try {
- // allSettled (not all): a mid-batch failure must not orphan the fields
- // that already persisted. Refetch unconditionally so the baseline matches
- // the server, then report partial failures by field name.
- const results = await Promise.allSettled(tasks.map((task) => task.run()))
- await refetch()
-
- const failed = tasks.filter((_, i) => results[i].status === 'rejected')
- if (failed.length === 0) {
- toastManager.add({
- type: 'success',
- title: t('admin.components.custom_fields.values_saved'),
- })
- setDrafts(null)
- setIsEditing(false)
- return
- }
-
- // Some saved, some didn't. Keep edit mode with drafts intact so the user
- // can retry — the refetched baseline means the succeeded fields now equal
- // their persisted value, so a retry only re-sends the failures.
- toastManager.add({
- type: 'error',
- title: t('admin.components.custom_fields.values_save_partial_failed', {
- fields: failed.map(({ def }) => def.label || def.key).join(', '),
- }),
- })
- } catch (err) {
- // refetch() itself failed (network) — the saves may still have landed.
- const message =
- err instanceof Error
- ? err.message
- : t('admin.components.custom_fields.errors.failed_to_save')
- toastManager.add({ type: 'error', title: message })
+ // On a partial failure edit mode stays open with the drafts intact.
+ if (await saveDraft({ announce: true })) setIsEditing(false)
} finally {
setSaving(false)
}
- }, [drafts, definitions, savedByDefinitionId, create, update, refetch, cancel, t])
+ }, [draft.isDirty, cancel, saveDraft])
const ctx = useMemo<CustomFieldsContextValue>(
() => ({
- state: { values },
- actions: { setValue },
+ state: { values: draft.values },
+ actions: { setValue: draft.setValue },
meta: {
- definitions,
- isLoading: defsLoading || valuesLoading,
+ definitions: draft.definitions,
+ isLoading: draft.isLoading,
resourceType,
resourceLabel,
+ canEdit: draft.canEdit,
+ loadFailed: draft.loadFailed,
},
mode: { kind: 'editable', isEditing, saving, startEdit, cancel, save },
}),
- [
- values,
- setValue,
- definitions,
- defsLoading,
- valuesLoading,
- resourceType,
- resourceLabel,
- isEditing,
- saving,
- startEdit,
- cancel,
- save,
- ],
+ [draft, resourceType, resourceLabel, isEditing, saving, startEdit, cancel, save],
)
return <CustomFieldsContext value={ctx}>{children}</CustomFieldsContext>
}
+/** The card on a detail page with no page-wide form: read-only until Edit, with its own Save. */
+export function ApiCustomFieldsCard({
+ ownerType,
+ ownerId,
+ hideWhenEmpty,
+}: {
+ ownerType: CustomFieldOwnerType
+ ownerId: string
+ hideWhenEmpty?: boolean
+}) {
+ return (
+ <EditableApiCustomFieldsProvider
+ ownerType={ownerType}
+ ownerId={ownerId}
+ resourceType={ownerType}
+ >
+ <CustomFieldsInlineCard hideWhenEmpty={hideWhenEmpty} />
+ </EditableApiCustomFieldsProvider>
+ )
+}
+
+/** The card inside a host form that saves `draft` from its own submit. */
+export function DraftCustomFieldsCard({
+ draft,
+ hideWhenEmpty,
+}: {
+ draft: CustomFieldsDraft
+ hideWhenEmpty?: boolean
+}) {
+ return (
+ <DraftCustomFieldsProvider draft={draft}>
+ <CustomFieldsInlineCard hideWhenEmpty={hideWhenEmpty} />
+ </DraftCustomFieldsProvider>
+ )
+}
+
// ---------------------------------------------------------------------------
// The card — implementation-agnostic. Reads context only.
// ---------------------------------------------------------------------------
-export function CustomFieldsInlineCard() {
+interface CustomFieldsInlineCardProps {
+ /**
+ * Renders nothing until the store defines a field for this resource. For
+ * sheets and secondary surfaces, where an empty card is clutter; fields are
+ * defined in Settings, which offers every resource with an edit surface.
+ */
+ hideWhenEmpty?: boolean
+}
+
+export function CustomFieldsInlineCard({ hideWhenEmpty = false }: CustomFieldsInlineCardProps) {
const { t } = useTranslation()
const [createOpen, setCreateOpen] = useState(false)
const {
- meta: { isLoading, definitions, resourceType, resourceLabel },
+ meta: { isLoading, definitions, resourceType, resourceLabel, canEdit, loadFailed },
mode,
} = useCustomFieldsContext()
@@ -449,6 +632,8 @@ export function CustomFieldsInlineCard() {
const hasDefinitions = definitions.length > 0
const openCreate = useCallback(() => setCreateOpen(true), [])
+ if (canEdit === false || (hideWhenEmpty && !hasDefinitions)) return null
+
return (
<Card>
<CardHeader className="flex flex-row items-center justify-between gap-3 space-y-0">
@@ -456,11 +641,15 @@ export function CustomFieldsInlineCard() {
<SquareTextIcon className="size-4" />
{t('admin.components.custom_fields.section_title')}
</CardTitle>
- {!isLoading && hasDefinitions && <EditableHeaderActions />}
+ {!isLoading && !loadFailed && hasDefinitions && <EditableHeaderActions />}
</CardHeader>
<CardContent>
{isLoading ? (
<LoadingRows />
+ ) : loadFailed ? (
+ <p className="text-sm text-destructive" role="alert">
+ {t('admin.components.custom_fields.errors.failed_to_load')}
+ </p>
) : !hasDefinitions ? (
<CustomFieldsEmptyState onSetUp={openCreate} />
) : editing ? (
diff --git a/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx b/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
index 4d32dc0072..284c74edf1 100644
--- a/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
+++ b/packages/dashboard/src/components/spree/custom-fields/definition-form.tsx
@@ -5,7 +5,10 @@ import {
Input,
Select,
SelectContent,
+ SelectGroup,
SelectItem,
+ SelectLabel,
+ SelectSeparator,
SelectTrigger,
SelectValue,
Switch,
@@ -73,12 +76,23 @@ export function DefinitionFormFields({
// From the server's registry. `DEFAULT_RESOURCE_TYPES` covers the first
// render while that request is in flight, so the select is never empty.
const { data: resourceTypesResponse } = useCustomFieldResourceTypes()
- const resourceTypeItems = resourceTypesResponse
- ? resourceTypesResponse.data.map(({ resource_type, name }) => ({
- value: resource_type,
- label: name,
- }))
- : DEFAULT_RESOURCE_TYPES.map((value) => ({ value, label: resourceTypeLabel(value) }))
+ const resourceTypeItems = (
+ resourceTypesResponse?.data ??
+ DEFAULT_RESOURCE_TYPES.map((value) => ({ resource_type: value, name: undefined }))
+ ).map(({ resource_type, name }) => ({
+ value: resource_type,
+ label: resourceTypeLabel(resource_type, name),
+ }))
+ // Types the dashboard edits come first; the rest are still definable for
+ // integrations, but say so, since no screen here fills them in.
+ const editableTypes = new Set<string>(DEFAULT_RESOURCE_TYPES)
+ const byLabel = (a: { label: string }, b: { label: string }) => a.label.localeCompare(b.label)
+ const editableTypeItems = resourceTypeItems
+ .filter((item) => editableTypes.has(item.value))
+ .sort(byLabel)
+ const apiOnlyTypeItems = resourceTypeItems
+ .filter((item) => !editableTypes.has(item.value))
+ .sort(byLabel)
return (
<div className="flex flex-col gap-4">
@@ -151,11 +165,28 @@ export function DefinitionFormFields({
<SelectValue />
</SelectTrigger>
<SelectContent>
- {resourceTypeItems.map((o) => (
- <SelectItem key={o.value} value={o.value}>
- {o.label}
- </SelectItem>
- ))}
+ <SelectGroup>
+ {editableTypeItems.map((o) => (
+ <SelectItem key={o.value} value={o.value}>
+ {o.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ {apiOnlyTypeItems.length > 0 && (
+ <>
+ <SelectSeparator />
+ <SelectGroup>
+ <SelectLabel>
+ {t('admin.fields.custom_field_definition.resource_type.api_only_group')}
+ </SelectLabel>
+ {apiOnlyTypeItems.map((o) => (
+ <SelectItem key={o.value} value={o.value}>
+ {o.label}
+ </SelectItem>
+ ))}
+ </SelectGroup>
+ </>
+ )}
</SelectContent>
</Select>
)}
diff --git a/packages/dashboard/src/components/spree/custom-fields/register.tsx b/packages/dashboard/src/components/spree/custom-fields/register.tsx
new file mode 100644
index 0000000000..bd82b8daf5
--- /dev/null
+++ b/packages/dashboard/src/components/spree/custom-fields/register.tsx
@@ -0,0 +1,61 @@
+import type { CustomFieldOwnerType } from '@spree/admin-sdk'
+import type { MediaFormValues, SheetSaveHandler, VariantFormValues } from '@spree/dashboard-core'
+import { registerSlot } from '@spree/dashboard-core'
+import { useEffect } from 'react'
+import { DraftCustomFieldsCard, useCustomFieldsDraft } from './custom-fields-inline'
+
+type OnSave = (handler: SheetSaveHandler) => () => void
+
+/**
+ * Editable like the rest of the sheet, kept by its Done and dropped by its
+ * Cancel. The values are a different record from the product, so they save on
+ * Done rather than waiting for the product's Save.
+ */
+function SheetCustomFields({
+ ownerType,
+ ownerId,
+ onSave,
+}: {
+ ownerType: CustomFieldOwnerType
+ ownerId: string
+ onSave: OnSave
+}) {
+ const draft = useCustomFieldsDraft(ownerType, ownerId)
+ const { save } = draft
+
+ useEffect(() => onSave(save), [onSave, save])
+
+ return <DraftCustomFieldsCard draft={draft} hideWhenEmpty />
+}
+
+function VariantSheetCustomFields({
+ variant,
+ onSave,
+}: {
+ variant: VariantFormValues
+ onSave: OnSave
+}) {
+ return <SheetCustomFields ownerType="variant" ownerId={variant.id ?? ''} onSave={onSave} />
+}
+
+function MediaSheetCustomFields({ media, onSave }: { media: MediaFormValues; onSave: OnSave }) {
+ return <SheetCustomFields ownerType="media" ownerId={media.id ?? ''} onSave={onSave} />
+}
+
+/**
+ * Custom fields inside the product page's variant and media sheets. Those
+ * sheets live in `@spree/dashboard-core`, which cannot import the card, so it
+ * arrives through their slots. Imported once for its side effects from the
+ * product page. Only saved rows have an id to hang values on.
+ */
+registerSlot<{ variant: VariantFormValues; onSave: OnSave }>('product.variant.form_fields', {
+ id: 'custom-fields',
+ if: ({ variant }) => !!variant.id,
+ component: VariantSheetCustomFields,
+})
+
+registerSlot<{ media: MediaFormValues; onSave: OnSave }>('product.media.form_fields', {
+ id: 'custom-fields',
+ if: ({ media }) => !!media.id,
+ component: MediaSheetCustomFields,
+})
diff --git a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-sheets.tsx b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-sheets.tsx
index 676df1e36e..ce2fdbc36b 100644
--- a/packages/dashboard/src/components/spree/payment-method-editors/payment-method-sheets.tsx
+++ b/packages/dashboard/src/components/spree/payment-method-editors/payment-method-sheets.tsx
@@ -28,6 +28,7 @@ import {
paymentMethodValuesToCreateParams,
paymentMethodValuesToUpdateParams,
} from '../../../schemas/payment-method'
+import { DraftCustomFieldsCard, useCustomFieldsDraft } from '../custom-fields/custom-fields-inline'
import { SetupGuideLink } from '../integrations/setup-guide-link'
import { PaymentMethodForm } from './payment-method-form'
import type { PaymentMethodFormValues } from './types'
@@ -177,6 +178,7 @@ export function EditPaymentMethodSheet({
const { t } = useTranslation()
const { data: paymentMethod, isLoading } = usePaymentMethod(id)
const updateMutation = useUpdatePaymentMethod(id)
+ const customFields = useCustomFieldsDraft('payment_method', id)
// The provider's preference schema comes from its `/types` entry, matched
// by the record's `type`.
const { data: typesData } = usePaymentMethodTypes({ enabled: open })
@@ -220,11 +222,20 @@ export function EditPaymentMethodSheet({
async function onSubmit(values: PaymentMethodFormValues) {
const params = paymentMethodValuesToUpdateParams(values)
- if (preferencesDirty) params.preferences = preferences
+ // Read from the ref rather than the memo: a retry runs before the next
+ // render recomputes it.
+ const prefsDirty = JSON.stringify(preferences) !== originalPreferencesRef.current
+ if (prefsDirty) params.preferences = preferences
try {
- await updateMutation.mutateAsync(params)
- form.reset(values)
- originalPreferencesRef.current = JSON.stringify(preferences)
+ // The record saves first and is marked clean, so a retry after a failed
+ // custom field save sends only the custom fields.
+ const savesRecord = form.formState.isDirty || prefsDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync(params)
+ form.reset(values)
+ originalPreferencesRef.current = JSON.stringify(preferences)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
onOpenChange(false)
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
@@ -269,6 +280,7 @@ export function EditPaymentMethodSheet({
preferences={preferences}
onPreferencesChange={setPreferences}
/>
+ <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />
</div>
<SheetFooter>
<Button
@@ -282,7 +294,8 @@ export function EditPaymentMethodSheet({
<Button
type="submit"
disabled={
- form.formState.isSubmitting || (!form.formState.isDirty && !preferencesDirty)
+ form.formState.isSubmitting ||
+ (!form.formState.isDirty && !preferencesDirty && !customFields.isDirty)
}
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
diff --git a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
index b6f5138fbb..69d41af2d0 100644
--- a/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
+++ b/packages/dashboard/src/components/spree/promotion-editors/promotion-form.tsx
@@ -77,6 +77,7 @@ import {
TableHeader,
TableRow,
Textarea,
+ toastManager,
} from '@spree/dashboard-ui'
import { optionValueLabel } from '../../../hooks/use-option-types'
import {
@@ -95,6 +96,7 @@ import {
type PromotionKind,
promotionFormSchema,
} from '../../../schemas/promotion'
+import { DraftCustomFieldsCard, useCustomFieldsDraft } from '../custom-fields/custom-fields-inline'
import {
actionDraftFromAction,
actionDraftFromType,
@@ -194,6 +196,12 @@ export function PromotionForm({
defaultValues: { ...PROMOTION_DEFAULTS, ...extensionFormValues('promotion', null) },
})
+ // Edit only: a promotion being created has no id to hang values on yet.
+ const customFields = useCustomFieldsDraft(
+ 'promotion',
+ mode === 'edit' ? (promotion?.id ?? '') : '',
+ )
+
const rulesArray = useFieldArray({ control: form.control, name: 'rules', keyName: '_key' })
const actionsArray = useFieldArray({ control: form.control, name: 'actions', keyName: '_key' })
@@ -239,7 +247,20 @@ export function PromotionForm({
Object.assign(payload, couponFieldsForKind(values))
}
try {
- await onSubmit(payload)
+ // The promotion saves first and is marked clean, so a retry after a
+ // failed custom field save sends only the custom fields — the rule and
+ // action sets would otherwise be submitted again. A failed save keeps
+ // its edits and names the fields itself.
+ const savesRecord = mode === 'create' || form.formState.isDirty
+ if (savesRecord) {
+ await onSubmit(payload)
+ if (mode === 'edit') form.reset(form.getValues())
+ }
+ const savesCustomFields = customFields.isDirty
+ // The promotion's own save toasts; a custom-field-only save has to say so.
+ if ((await customFields.save()) && savesCustomFields && !savesRecord) {
+ toastManager.add({ type: 'success', title: t('admin.messages.promotion_saved') })
+ }
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
}
@@ -301,7 +322,8 @@ export function PromotionForm({
<Button
type="submit"
disabled={
- form.formState.isSubmitting || (mode === 'edit' && !form.formState.isDirty)
+ form.formState.isSubmitting ||
+ (mode === 'edit' && !form.formState.isDirty && !customFields.isDirty)
}
>
{form.formState.isSubmitting
@@ -337,6 +359,7 @@ export function PromotionForm({
<BasicsCard form={form} />
<TriggerCard mode={mode} form={form} promotion={promotion} />
<ScheduleCard form={form} />
+ {mode === 'edit' && <DraftCustomFieldsCard draft={customFields} />}
<Slot name="promotion.form_sidebar" context={{ promotion, mode }} />
</>
}
diff --git a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
index 546d3317b7..ea1aaa4936 100644
--- a/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
+++ b/packages/dashboard/src/components/spree/shipping/delivery-method-sheet.tsx
@@ -32,6 +32,7 @@ import {
deliveryMethodFormSchema,
deliveryMethodValuesToParams,
} from '../../../schemas/delivery-method'
+import { DraftCustomFieldsCard, useCustomFieldsDraft } from '../custom-fields/custom-fields-inline'
import { DeliveryMethodFormCards } from './delivery-method-form'
/** API decimals arrive as strings ("0.0"); show blank instead of a noisy zero. */
@@ -92,6 +93,8 @@ export function DeliveryMethodSheet({
const { data: fulfillmentProviders } = useFulfillmentProviders()
const createMutation = useCreateDeliveryMethod()
const updateMutation = useUpdateDeliveryMethod(methodId ?? '')
+ // Edit only: a method being created has no id to hang values on yet.
+ const customFields = useCustomFieldsDraft('delivery_method', methodId ?? '')
// Saving sends the full rule set for reconciliation, so the form must not be
// reachable until the existing rules have loaded — otherwise a quick save
@@ -188,10 +191,17 @@ export function DeliveryMethodSheet({
async function onSubmit(values: DeliveryMethodFormValues) {
try {
if (editing) {
- await updateMutation.mutateAsync({
- ...deliveryMethodValuesToParams(values),
- ...extensionSubmitValues('delivery_method', form),
- })
+ // The method saves first and is marked clean, so a retry after a
+ // failed custom field save sends only the custom fields.
+ const savesRecord = form.formState.isDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync({
+ ...deliveryMethodValuesToParams(values),
+ ...extensionSubmitValues('delivery_method', form),
+ })
+ form.reset(values)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
} else {
await createMutation.mutateAsync({
...deliveryMethodValuesToParams(values),
@@ -251,6 +261,7 @@ export function DeliveryMethodSheet({
mode: editing ? 'edit' : 'new',
}}
/>
+ {editing && <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />}
</div>
<SheetFooter>
<Button
@@ -263,7 +274,10 @@ export function DeliveryMethodSheet({
</Button>
<Button
type="submit"
- disabled={form.formState.isSubmitting || (editing && !form.formState.isDirty)}
+ disabled={
+ form.formState.isSubmitting ||
+ (editing && !form.formState.isDirty && !customFields.isDirty)
+ }
>
{form.formState.isSubmitting
? editing
diff --git a/packages/dashboard/src/locales/ar.json b/packages/dashboard/src/locales/ar.json
index 3e70edb769..27c3c3a8ef 100644
--- a/packages/dashboard/src/locales/ar.json
+++ b/packages/dashboard/src/locales/ar.json
@@ -581,7 +581,8 @@
"empty_description": "تتبّع تفاصيل منظمة مثل الخامة أو المقاس أو تعليمات العناية.",
"empty_title": "لا توجد حقول مخصصة بعد",
"errors": {
- "failed_to_save": "فشل حفظ الحقل المخصص"
+ "failed_to_save": "فشل حفظ الحقل المخصص",
+ "failed_to_load": "تعذّر تحميل الحقول المخصصة. أعد تحميل الصفحة للمحاولة مرة أخرى."
},
"manage_in_settings": "الإدارة في الإعدادات",
"new_definition_description": "حدّد حقلاً مخصصاً لتخزين معلومات مكتوبة ومنظمة في {{resource}} الخاصة بك.",
@@ -1458,9 +1459,24 @@
"product": "المنتجات",
"category": "الفئات",
"customer": "العملاء",
- "variant": "المتغيرات"
+ "variant": "المتغيرات",
+ "seller": "البائعون",
+ "collection": "المجموعات",
+ "promotion": "العروض الترويجية",
+ "gift_card": "بطاقات الهدايا",
+ "store_credit": "أرصدة المتجر",
+ "stock_transfer": "التحويلات",
+ "purchase_order": "أوامر الشراء",
+ "company": "الشركات",
+ "payment_method": "طرق الدفع",
+ "delivery_method": "طرق التوصيل",
+ "tax_rate": "نسب الضريبة",
+ "product_type": "أنواع المنتجات",
+ "media": "الوسائط",
+ "store": "المتجر"
},
- "read_only_help": "لا يمكن تغيير المالك بعد وجود قيم لهذا الحقل."
+ "read_only_help": "لا يمكن تغيير المالك بعد وجود قيم لهذا الحقل.",
+ "api_only_group": "عبر واجهة البرمجة فقط"
},
"searchable": {
"help": "تضمين القيم في بحث منتجات الواجهة (نص قصير ونص طويل ورقم فقط). بعد التفعيل مع Meilisearch، نفّذ rake spree:search:reindex لتحديث المنتجات الحالية.",
diff --git a/packages/dashboard/src/locales/de.json b/packages/dashboard/src/locales/de.json
index 9d236856d9..a89bc91244 100644
--- a/packages/dashboard/src/locales/de.json
+++ b/packages/dashboard/src/locales/de.json
@@ -574,7 +574,8 @@
"empty_description": "Erfassen Sie strukturierte Details wie Material, Passform oder Pflegehinweise.",
"empty_title": "Noch keine benutzerdefinierten Felder",
"errors": {
- "failed_to_save": "Benutzerdefiniertes Feld konnte nicht gespeichert werden"
+ "failed_to_save": "Benutzerdefiniertes Feld konnte nicht gespeichert werden",
+ "failed_to_load": "Benutzerdefinierte Felder konnten nicht geladen werden. Lade die Seite neu, um es erneut zu versuchen."
},
"manage_in_settings": "In den Einstellungen verwalten",
"new_definition_description": "Definieren Sie ein benutzerdefiniertes Feld, um typisierte, strukturierte Informationen zu Ihren {{resource}} zu speichern.",
@@ -1440,9 +1441,24 @@
"product": "Produkte",
"category": "Kategorien",
"customer": "Kunden",
- "variant": "Varianten"
+ "variant": "Varianten",
+ "seller": "Verkäufer",
+ "collection": "Kollektionen",
+ "promotion": "Aktionen",
+ "gift_card": "Geschenkkarten",
+ "store_credit": "Guthaben",
+ "stock_transfer": "Umlagerungen",
+ "purchase_order": "Einkaufsbestellungen",
+ "company": "Firmen",
+ "payment_method": "Zahlungsmethoden",
+ "delivery_method": "Versandarten",
+ "tax_rate": "Steuersätze",
+ "product_type": "Produkttypen",
+ "media": "Medien",
+ "store": "Shop"
},
- "read_only_help": "Der Eigentümer kann nicht mehr geändert werden, sobald Werte für dieses Feld vorhanden sind."
+ "read_only_help": "Der Eigentümer kann nicht mehr geändert werden, sobald Werte für dieses Feld vorhanden sind.",
+ "api_only_group": "Nur über die API"
},
"searchable": {
"help": "Werte in die Storefront-Produktsuche aufnehmen (nur Kurztext, Langtext und Zahl). Nach dem Aktivieren mit Meilisearch rake spree:search:reindex ausführen, damit bestehende Produkte aktualisiert werden.",
diff --git a/packages/dashboard/src/locales/en.json b/packages/dashboard/src/locales/en.json
index b4f6540c08..bd06d49273 100644
--- a/packages/dashboard/src/locales/en.json
+++ b/packages/dashboard/src/locales/en.json
@@ -574,7 +574,8 @@
"empty_description": "Track structured details like material, fit, or care instructions.",
"empty_title": "No custom fields yet",
"errors": {
- "failed_to_save": "Failed to save custom field"
+ "failed_to_save": "Failed to save custom field",
+ "failed_to_load": "Custom fields could not be loaded. Reload the page to try again."
},
"manage_in_settings": "Manage in settings",
"new_definition_description": "Define a custom field to store typed, structured information on your {{resource}}.",
@@ -1440,9 +1441,24 @@
"product": "Products",
"category": "Categories",
"customer": "Customers",
- "variant": "Variants"
+ "variant": "Variants",
+ "seller": "Sellers",
+ "collection": "Collections",
+ "promotion": "Promotions",
+ "gift_card": "Gift cards",
+ "store_credit": "Store credits",
+ "stock_transfer": "Stock transfers",
+ "purchase_order": "Purchase orders",
+ "company": "Companies",
+ "payment_method": "Payment methods",
+ "delivery_method": "Delivery methods",
+ "tax_rate": "Tax rates",
+ "product_type": "Product types",
+ "media": "Media",
+ "store": "Store"
},
- "read_only_help": "The owner can't be changed once values exist for this field."
+ "read_only_help": "The owner can't be changed once values exist for this field.",
+ "api_only_group": "Through the API only"
},
"searchable": {
"help": "Include values in storefront product text search (short text, long text, and number only). After enabling with Meilisearch, run rake spree:search:reindex so existing products are updated.",
diff --git a/packages/dashboard/src/locales/es.json b/packages/dashboard/src/locales/es.json
index ad3c4087e1..5a77843433 100644
--- a/packages/dashboard/src/locales/es.json
+++ b/packages/dashboard/src/locales/es.json
@@ -1343,9 +1343,24 @@
"product": "Productos",
"category": "Categorías",
"customer": "Clientes",
- "variant": "Variantes"
+ "variant": "Variantes",
+ "seller": "Vendedores",
+ "collection": "Colecciones",
+ "promotion": "Promociones",
+ "gift_card": "Tarjetas de regalo",
+ "store_credit": "Créditos de tienda",
+ "stock_transfer": "Transferencias",
+ "purchase_order": "Órdenes de compra",
+ "company": "Empresas",
+ "payment_method": "Métodos de pago",
+ "delivery_method": "Métodos de entrega",
+ "tax_rate": "Tasas de impuestos",
+ "product_type": "Tipos de producto",
+ "media": "Medios",
+ "store": "Tienda"
},
- "read_only_help": "El propietario no se puede cambiar una vez que existen valores para este campo."
+ "read_only_help": "El propietario no se puede cambiar una vez que existen valores para este campo.",
+ "api_only_group": "Solo a través de la API"
},
"searchable": {
"help": "Incluir los valores en la búsqueda de texto de productos del storefront (solo texto corto, texto largo y número). Después de activarlo con Meilisearch, ejecutá rake spree:search:reindex para actualizar los productos existentes.",
@@ -5609,7 +5624,8 @@
"empty_description": "Seguí detalles estructurados como material, calce o instrucciones de cuidado.",
"empty_title": "Todavía no hay campos personalizados",
"errors": {
- "failed_to_save": "No se pudo guardar el campo personalizado"
+ "failed_to_save": "No se pudo guardar el campo personalizado",
+ "failed_to_load": "No se pudieron cargar los campos personalizados. Recarga la página para intentarlo de nuevo."
},
"manage_in_settings": "Gestionar en configuración",
"new_definition_description": "Definí un campo personalizado para guardar información tipada y estructurada en tus {{resource}}.",
diff --git a/packages/dashboard/src/locales/fr.json b/packages/dashboard/src/locales/fr.json
index 1f522c3d5c..bd458a862f 100644
--- a/packages/dashboard/src/locales/fr.json
+++ b/packages/dashboard/src/locales/fr.json
@@ -574,7 +574,8 @@
"empty_description": "Suivez des détails structurés comme la matière, la coupe ou les instructions d’entretien.",
"empty_title": "Aucun champ personnalisé pour le moment",
"errors": {
- "failed_to_save": "Impossible d’enregistrer le champ personnalisé"
+ "failed_to_save": "Impossible d’enregistrer le champ personnalisé",
+ "failed_to_load": "Impossible de charger les champs personnalisés. Rechargez la page pour réessayer."
},
"manage_in_settings": "Gérer dans les paramètres",
"new_definition_description": "Définissez un champ personnalisé pour stocker des informations typées et structurées sur vos {{resource}}.",
@@ -1440,9 +1441,24 @@
"product": "Produits",
"category": "Catégories",
"customer": "Clients",
- "variant": "Variantes"
+ "variant": "Variantes",
+ "seller": "Vendeurs",
+ "collection": "Collections",
+ "promotion": "Promotions",
+ "gift_card": "Cartes cadeaux",
+ "store_credit": "Avoirs en boutique",
+ "stock_transfer": "Transferts",
+ "purchase_order": "Bons de commande",
+ "company": "Entreprises",
+ "payment_method": "Modes de paiement",
+ "delivery_method": "Modes de livraison",
+ "tax_rate": "Taux de taxe",
+ "product_type": "Types de produit",
+ "media": "Médias",
+ "store": "Boutique"
},
- "read_only_help": "Le propriétaire ne peut pas être modifié une fois que des valeurs existent pour ce champ."
+ "read_only_help": "Le propriétaire ne peut pas être modifié une fois que des valeurs existent pour ce champ.",
+ "api_only_group": "Uniquement via l'API"
},
"searchable": {
"help": "Inclure les valeurs dans la recherche de produits de la boutique (texte court, texte long et nombre uniquement). Après activation avec Meilisearch, exécutez rake spree:search:reindex pour mettre à jour les produits existants.",
diff --git a/packages/dashboard/src/locales/pl.json b/packages/dashboard/src/locales/pl.json
index 4799d3d73d..54a460cb91 100644
--- a/packages/dashboard/src/locales/pl.json
+++ b/packages/dashboard/src/locales/pl.json
@@ -584,7 +584,8 @@
"empty_description": "Śledź ustrukturyzowane szczegóły, takie jak materiał, krój czy instrukcje pielęgnacji.",
"empty_title": "Brak pól niestandardowych",
"errors": {
- "failed_to_save": "Nie udało się zapisać pola niestandardowego"
+ "failed_to_save": "Nie udało się zapisać pola niestandardowego",
+ "failed_to_load": "Nie udało się wczytać pól niestandardowych. Odśwież stronę, aby spróbować ponownie."
},
"manage_in_settings": "Zarządzaj w ustawieniach",
"new_definition_description": "Zdefiniuj pole niestandardowe, aby przechowywać typowane, ustrukturyzowane informacje dla: {{resource}}.",
@@ -1458,9 +1459,24 @@
"product": "Produkty",
"category": "Kategorie",
"customer": "Klienci",
- "variant": "Warianty"
+ "variant": "Warianty",
+ "seller": "Sprzedawcy",
+ "collection": "Kolekcje",
+ "promotion": "Promocje",
+ "gift_card": "Karty podarunkowe",
+ "store_credit": "Środki w sklepie",
+ "stock_transfer": "Transfery",
+ "purchase_order": "Zamówienia zakupu",
+ "company": "Firmy",
+ "payment_method": "Metody płatności",
+ "delivery_method": "Metody dostawy",
+ "tax_rate": "Stawki podatku",
+ "product_type": "Typy produktów",
+ "media": "Multimedia",
+ "store": "Sklep"
},
- "read_only_help": "Właściciela nie można zmienić, gdy istnieją już wartości dla tego pola."
+ "read_only_help": "Właściciela nie można zmienić, gdy istnieją już wartości dla tego pola.",
+ "api_only_group": "Tylko przez API"
},
"searchable": {
"help": "Uwzględnij wartości w wyszukiwaniu produktów storefront (tylko krótki tekst, długi tekst i liczba). Po włączeniu z Meilisearch uruchom rake spree:search:reindex, aby zaktualizować istniejące produkty.",
diff --git a/packages/dashboard/src/locales/zh-CN.json b/packages/dashboard/src/locales/zh-CN.json
index c008c3c030..53f3496f08 100644
--- a/packages/dashboard/src/locales/zh-CN.json
+++ b/packages/dashboard/src/locales/zh-CN.json
@@ -572,7 +572,8 @@
"empty_description": "记录结构化的详细信息,例如材质、版型或保养说明。",
"empty_title": "尚无自定义字段",
"errors": {
- "failed_to_save": "保存自定义字段失败"
+ "failed_to_save": "保存自定义字段失败",
+ "failed_to_load": "无法加载自定义字段。请刷新页面重试。"
},
"manage_in_settings": "在设置中管理",
"new_definition_description": "定义自定义字段,以在您的{{resource}}上存储有类型的结构化信息。",
@@ -1435,9 +1436,24 @@
"product": "商品",
"category": "分类",
"customer": "客户",
- "variant": "变体"
+ "variant": "变体",
+ "seller": "卖家",
+ "collection": "系列",
+ "promotion": "促销",
+ "gift_card": "礼品卡",
+ "store_credit": "店铺信用",
+ "stock_transfer": "调拨",
+ "purchase_order": "采购订单",
+ "company": "企业",
+ "payment_method": "支付方式",
+ "delivery_method": "配送方式",
+ "tax_rate": "税率",
+ "product_type": "商品类型",
+ "media": "媒体",
+ "store": "店铺"
},
- "read_only_help": "一旦此字段存在值,所属对象便无法更改。"
+ "read_only_help": "一旦此字段存在值,所属对象便无法更改。",
+ "api_only_group": "仅通过 API"
},
"searchable": {
"help": "将值纳入店面商品全文搜索(仅短文本、长文本和数字)。启用 Meilisearch 后请运行 rake spree:search:reindex,以便更新现有商品。",
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
index 70855db9ab..74b0e13977 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/companies/$companyId.tsx
@@ -53,6 +53,7 @@ import { Controller, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { CompanyAddressSheet } from '../../../../components/spree/company-address-sheet'
import { CompanyKindBadge } from '../../../../components/spree/company-kind-badge'
+import { ApiCustomFieldsCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
import { EnterpriseUpsell } from '../../../../components/spree/enterprise-upsell'
import { ResourceDetailSkeleton } from '../../../../components/spree/route-pending'
import { TaxExemptionCertificatesCard } from '../../../../components/spree/tax-exemption-certificates-card'
@@ -170,6 +171,7 @@ function CompanyBody({ company }: { company: Company }) {
) : (
<CompanyTaxIdentifiersCard companyId={company.id} canEdit={canEdit} />
)}
+ <ApiCustomFieldsCard ownerType="company" ownerId={company.id} />
<Slot name="company.form_sidebar" context={{ company, kind: company.kind, canEdit }} />
</>
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/gift-cards.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/gift-cards.tsx
index 74d97c382b..731af8898d 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/gift-cards.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/gift-cards.tsx
@@ -62,6 +62,10 @@ import {
} from '../../../../schemas/gift-card'
import '../../../../tables/gift-cards'
import { Money } from '@spree/dashboard-core'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../components/spree/custom-fields/custom-fields-inline'
const giftCardsSearchSchema = resourceSearchSchema.extend({
edit: z.string().optional(),
@@ -270,6 +274,7 @@ function EditGiftCardSheet({
const { t } = useTranslation()
const { data: giftCard, isLoading } = useGiftCard(id, ['customer', 'created_by', 'orders'])
const updateMutation = useUpdateGiftCard(id)
+ const customFields = useCustomFieldsDraft('gift_card', id)
const form = useForm<GiftCardEditFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -305,8 +310,15 @@ function EditGiftCardSheet({
async function onSubmit(values: GiftCardEditFormValues) {
try {
- await updateMutation.mutateAsync(giftCardEditValuesToParams(values))
- form.reset(values)
+ // A read-only card can still have its custom fields changed. The card
+ // saves first and is marked clean, so a retry after a failed custom field
+ // save sends only the custom fields.
+ const savesRecord = editable && form.formState.isDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync(giftCardEditValuesToParams(values))
+ form.reset(values)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
onOpenChange(false)
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
@@ -345,6 +357,7 @@ function EditGiftCardSheet({
)}
<EditGiftCardFormFields form={form} readOnly={!editable} />
<GiftCardUsageSummary giftCard={giftCard} />
+ <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />
</div>
<SheetFooter>
<Button
@@ -357,7 +370,10 @@ function EditGiftCardSheet({
</Button>
<Button
type="submit"
- disabled={!editable || form.formState.isSubmitting || !form.formState.isDirty}
+ disabled={
+ form.formState.isSubmitting ||
+ !((editable && form.formState.isDirty) || customFields.isDirty)
+ }
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
index 4ec9e31a92..de97e305d5 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/loyalty/store-credits.tsx
@@ -40,6 +40,7 @@ import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'
import { useRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
+import { ApiCustomFieldsCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
import { EditStoreCreditDialog } from '../../../../components/spree/store-credits/edit-store-credit-dialog'
import { IssueStoreCreditDialog } from '../../../../components/spree/store-credits/issue-store-credit-dialog'
import { useDeleteCustomerStoreCredit } from '../../../../hooks/use-customer-store-credits'
@@ -376,6 +377,8 @@ function StoreCreditSheet({
/>
</dl>
+ <ApiCustomFieldsCard ownerType="store_credit" ownerId={credit.id} hideWhenEmpty />
+
<div className="flex flex-col gap-2">
<h3 className="font-medium text-sm">{t('admin.store_credits.ledger.title')}</h3>
{eventsError ? (
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
index 3b47c9f4d9..8592bce862 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/$productId.tsx
@@ -39,6 +39,7 @@ import { useEffect } from 'react'
import { FormProvider, useForm, useWatch } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { CustomFieldsInlineCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
+import '../../../../components/spree/custom-fields/register'
import { MediaRichTextEditor } from '../../../../components/spree/media-rich-text-editor'
import { DigitalAssetsCard } from '../../../../components/spree/products/digital-assets-card'
import { ProductCustomFieldsProvider } from '../../../../components/spree/products/product-custom-fields-provider'
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
index 8b904424e4..1b59f49303 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/media.tsx
@@ -55,6 +55,10 @@ import { useDeferredValue, useEffect, useRef, useState } from 'react'
import { FormProvider, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../components/spree/custom-fields/custom-fields-inline'
import {
mediaPreviewUrl,
mediaThumbnailUrl,
@@ -479,7 +483,8 @@ function MediaDetailSheet({
const references = usage.data?.data ?? []
- const isDirty = !!media && form.formState.isDirty
+ const customFields = useCustomFieldsDraft('media', media?.id ?? '')
+ const isDirty = !!media && (form.formState.isDirty || customFields.isDirty)
// An explicit save, not save-on-blur: blur is invisible, so a merchant had
// no way to tell whether their edit stuck.
@@ -487,16 +492,23 @@ function MediaDetailSheet({
if (!media || !isDirty) return
try {
- await updateFile.mutateAsync({
- id: media.id,
- alt: values.alt,
- ...extensionSubmitValues('media', form),
- })
- // Re-baselined against what was just saved, not the record the sheet
- // opened with: that snapshot never refreshes, so after a save every
- // close would otherwise ask to discard.
- form.reset(form.getValues())
- toastManager.add({ type: 'success', title: t('admin.messages.saved') })
+ if (form.formState.isDirty) {
+ const submitted = form.getValues()
+ await updateFile.mutateAsync({
+ id: media.id,
+ alt: values.alt,
+ ...extensionSubmitValues('media', form),
+ })
+ // Re-baselined against what was just saved, not the record the sheet
+ // opened with: that snapshot never refreshes, so after a save every
+ // close would otherwise ask to discard. Also keeps a retry after a
+ // failed custom field save from re-sending the file. An edit typed
+ // while the request was out stays on screen and stays unsaved.
+ form.reset(submitted, { keepValues: true })
+ }
+ if (await customFields.save()) {
+ toastManager.add({ type: 'success', title: t('admin.messages.saved') })
+ }
} catch (error) {
if (!mapSpreeErrorsToForm(error, form.setError)) {
toastManager.add({ type: 'error', title: t('admin.errors.failed_to_save') })
@@ -589,6 +601,8 @@ function MediaDetailSheet({
<Slot name="media.form_fields" context={{ media, canWrite }} />
+ {canWrite && <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />}
+
<dl className="space-y-2 text-sm">
<FileFact
label={t('admin.media_library.facts.type')}
@@ -648,8 +662,8 @@ function MediaDetailSheet({
<Button type="button" variant="outline" onClick={() => onOpenChange(false)}>
{t('admin.actions.cancel')}
</Button>
- <Button type="submit" disabled={!isDirty || updateFile.isPending}>
- {updateFile.isPending && <Loader2Icon className="size-4 animate-spin" />}
+ <Button type="submit" disabled={!isDirty || form.formState.isSubmitting}>
+ {form.formState.isSubmitting && <Loader2Icon className="size-4 animate-spin" />}
{t('admin.actions.save')}
</Button>
</SheetFooter>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
index 9e25cbb800..109e0a3594 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/products/options.tsx
@@ -105,6 +105,10 @@ import {
valueToParam,
} from '../../../../schemas/option-type'
import '../../../../tables/option-types'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../components/spree/custom-fields/custom-fields-inline'
const optionTypesSearchSchema = resourceSearchSchema.extend({
edit: z.string().optional(),
@@ -298,6 +302,7 @@ function EditOptionTypeSheet({
const { t } = useTranslation()
const { data: optionType, isLoading } = useOptionType(id)
const updateMutation = useUpdateOptionType(id)
+ const customFields = useCustomFieldsDraft('option_type', id)
const form = useForm<OptionTypeFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -318,11 +323,18 @@ function EditOptionTypeSheet({
async function onSubmit(values: OptionTypeFormValues) {
try {
- await updateMutation.mutateAsync({
- ...values,
- ...extensionSubmitValues('option_type', form),
- option_values: values.option_values.map(valueToParam),
- })
+ // The record saves first and is marked clean, so a retry after a failed
+ // custom field save sends only the custom fields.
+ const savesRecord = form.formState.isDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync({
+ ...values,
+ ...extensionSubmitValues('option_type', form),
+ option_values: values.option_values.map(valueToParam),
+ })
+ form.reset(values)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
// The sheet closes here; the `useOptionType` cache invalidation done by
// the mutation hook re-hydrates the form via `useEffect` the next time
// the sheet opens. Don't reset from the update response — the v3
@@ -385,6 +397,7 @@ function EditOptionTypeSheet({
context={{ optionType, mode: 'edit' }}
/>
<OptionValuesFieldArray form={form} />
+ <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />
</div>
<SheetFooter>
<Button
@@ -397,7 +410,9 @@ function EditOptionTypeSheet({
</Button>
<Button
type="submit"
- disabled={form.formState.isSubmitting || !form.formState.isDirty}
+ disabled={
+ form.formState.isSubmitting || (!form.formState.isDirty && !customFields.isDirty)
+ }
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/index.tsx
index f1af825e56..4b0e64b98f 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/purchase-orders/$purchaseOrderId/index.tsx
@@ -38,6 +38,7 @@ import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
import { CloseShortDialog } from '../../../../../components/spree/close-short-dialog'
+import { ApiCustomFieldsCard } from '../../../../../components/spree/custom-fields/custom-fields-inline'
import { InventoryStatusBadge } from '../../../../../components/spree/inventory-status-badge'
import { ReceiveDeliveryCard } from '../../../../../components/spree/receive-delivery-card'
import { ResourceDetailSkeleton } from '../../../../../components/spree/route-pending'
@@ -102,6 +103,7 @@ function PurchaseOrderDetailPage() {
sidebar={
<>
<SummaryCard purchaseOrder={purchaseOrder} />
+ <ApiCustomFieldsCard ownerType="purchase_order" ownerId={purchaseOrder.id} />
<Slot name="purchase_order.form_sidebar" context={{ purchaseOrder }} />
</>
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
index a40344359f..fdb2d2c0d0 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/sellers/$sellerId.tsx
@@ -13,6 +13,7 @@ import { BanIcon, MailIcon, PauseIcon, UndoIcon } from '@spree/dashboard-ui/icon
import { createFileRoute, useNavigate } from '@tanstack/react-router'
import { useState } from 'react'
import { useTranslation } from 'react-i18next'
+import { ApiCustomFieldsCard } from '../../../../components/spree/custom-fields/custom-fields-inline'
import { EnterprisePreviewNote } from '../../../../components/spree/enterprise-upsell'
import { ResourceDetailSkeleton } from '../../../../components/spree/route-pending'
import { SellerAddressCard } from '../../../../components/spree/sellers/seller-address-card'
@@ -290,6 +291,7 @@ function SellerBody({ seller }: { seller: Seller }) {
canEdit={canEdit}
onEdit={() => setEditingSettlement(true)}
/>
+ <ApiCustomFieldsCard ownerType="seller" ownerId={seller.id} />
<EnterprisePreviewNote previewKey="sellers.shopify" />
<Slot name="seller.form_sidebar" context={{ seller, canEdit }} />
</>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
index ffac9077e9..a52d2e7806 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/product-types.tsx
@@ -72,6 +72,10 @@ import {
useUpdateProductType,
} from '../../../../hooks/use-product-types'
import '../../../../tables/product-types'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../components/spree/custom-fields/custom-fields-inline'
const productTypeFormSchema = z.object({
name: z.string().min(1),
@@ -279,6 +283,7 @@ function EditProductTypeSheet({
const { t } = useTranslation()
const { data: productType, isLoading } = useProductType(id)
const updateMutation = useUpdateProductType(id)
+ const customFields = useCustomFieldsDraft('product_type', id)
const form = useForm<ProductTypeFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -306,11 +311,17 @@ function EditProductTypeSheet({
async function onSubmit(values: ProductTypeFormValues) {
try {
- await updateMutation.mutateAsync({
- ...withSortOrder(values),
- ...extensionSubmitValues('product_type', form),
- })
- form.reset(values)
+ // The record saves first and is marked clean, so a retry after a failed
+ // custom field save sends only the custom fields.
+ const savesRecord = form.formState.isDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync({
+ ...withSortOrder(values),
+ ...extensionSubmitValues('product_type', form),
+ })
+ form.reset(values)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
onOpenChange(false)
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
@@ -336,6 +347,7 @@ function EditProductTypeSheet({
context={{ productType, mode: 'edit' }}
/>
<ApplyToProductsSection id={id} productType={productType} />
+ <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />
</div>
<SheetFooter>
<Button
@@ -348,7 +360,9 @@ function EditProductTypeSheet({
</Button>
<Button
type="submit"
- disabled={form.formState.isSubmitting || !form.formState.isDirty}
+ disabled={
+ form.formState.isSubmitting || (!form.formState.isDirty && !customFields.isDirty)
+ }
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
index e6a6a80eab..4687c0c03e 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/store.tsx
@@ -43,7 +43,7 @@ import {
useFormSubmitShortcut,
} from '@spree/dashboard-ui'
import { createFileRoute } from '@tanstack/react-router'
-import { useCallback, useEffect, useMemo } from 'react'
+import { useCallback, useEffect, useMemo, useRef } from 'react'
import {
type Control,
Controller,
@@ -54,6 +54,10 @@ import {
} from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { ChoiceCardPicker } from '../../../../components/spree/choice-card-picker'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../components/spree/custom-fields/custom-fields-inline'
import {
useStoreDataSources,
useStoreSettings,
@@ -178,12 +182,19 @@ function StoreSettingsForm({ store }: { store: Store }) {
const updateMutation = useUpdateStoreSettings()
const switchAdminLocale = useSwitchAdminLocale()
const { data: dataSources } = useStoreDataSources()
+ const customFields = useCustomFieldsDraft('store', store.id)
const form = useForm<StoreSettingsFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
resolver: zodResolver(storeSettingsFormSchema) as any,
defaultValues: { ...storeToFormValues(store), ...extensionFormValues('store', store) },
})
+ // Read during render: React Hook Form only tracks `isDirty` once something
+ // has read it, and the header's Save button reads its own copy.
+ const storeDirty = form.formState.isDirty
+ // A language change saved with the store but held back by a failed custom
+ // field save. The retry no longer sees it against the refreshed store.
+ const pendingLocaleSwitch = useRef(false)
// Shows the merchant the shape their next order number will take. The
// sequential preview uses the configured starting value, which is only
@@ -222,49 +233,56 @@ function StoreSettingsForm({ store }: { store: Store }) {
// Select via Controller doesn't reliably populate). Saving unrelated fields
// (name, timezone, units) must not touch the admin's UI language.
const code = values.admin_locale
- const localeChanged = (code ?? '') !== (store.admin_locale ?? '')
+ const localeChanged = (code ?? '') !== (store.admin_locale ?? '') || pendingLocaleSwitch.current
// Extension fields come from live form state — the Zod parse behind
// `values` strips keys the first-party schema doesn't know.
const extensionValues = extensionSubmitValues('store', form)
try {
- await updateMutation.mutateAsync({
- name: values.name,
- admin_locale: values.admin_locale || undefined,
- timezone: values.timezone,
- unit_system: values.unit_system,
- weight_unit: values.weight_unit,
- storefront_access: values.storefront_access,
- guest_checkout: values.guest_checkout,
- always_include_confirm_step: values.always_include_confirm_step,
- company_field_enabled: values.company_field_enabled,
- address_requires_phone: values.address_requires_phone,
- capture_method: values.capture_method,
- pricing_provider: values.pricing_provider,
- inventory_provider: values.inventory_provider,
- pricing_provider_failure_policy: values.pricing_provider_failure_policy,
- inventory_provider_failure_policy: values.inventory_provider_failure_policy,
- tax_using_ship_address: values.tax_using_ship_address,
- track_inventory_levels: values.track_inventory_levels,
- stock_reservations_enabled: values.stock_reservations_enabled,
- low_stock_threshold: values.low_stock_threshold,
- track_price_history: values.track_price_history,
- show_products_without_price: values.show_products_without_price,
- disable_sku_validation: values.disable_sku_validation,
- document_number_format: values.document_number_format,
- order_number_prefix: values.order_number_prefix,
- order_number_suffix: values.order_number_suffix,
- order_number_sequence_start: values.order_number_sequence_start,
- limit_digital_download_count: values.limit_digital_download_count,
- digital_asset_authorized_clicks: values.digital_asset_authorized_clicks,
- limit_digital_download_days: values.limit_digital_download_days,
- digital_asset_authorized_days: values.digital_asset_authorized_days,
- ...extensionValues,
- })
+ if (storeDirty) {
+ await updateMutation.mutateAsync({
+ name: values.name,
+ admin_locale: values.admin_locale || undefined,
+ timezone: values.timezone,
+ unit_system: values.unit_system,
+ weight_unit: values.weight_unit,
+ storefront_access: values.storefront_access,
+ guest_checkout: values.guest_checkout,
+ always_include_confirm_step: values.always_include_confirm_step,
+ company_field_enabled: values.company_field_enabled,
+ address_requires_phone: values.address_requires_phone,
+ capture_method: values.capture_method,
+ pricing_provider: values.pricing_provider,
+ inventory_provider: values.inventory_provider,
+ pricing_provider_failure_policy: values.pricing_provider_failure_policy,
+ inventory_provider_failure_policy: values.inventory_provider_failure_policy,
+ tax_using_ship_address: values.tax_using_ship_address,
+ track_inventory_levels: values.track_inventory_levels,
+ stock_reservations_enabled: values.stock_reservations_enabled,
+ low_stock_threshold: values.low_stock_threshold,
+ track_price_history: values.track_price_history,
+ show_products_without_price: values.show_products_without_price,
+ disable_sku_validation: values.disable_sku_validation,
+ document_number_format: values.document_number_format,
+ order_number_prefix: values.order_number_prefix,
+ order_number_suffix: values.order_number_suffix,
+ order_number_sequence_start: values.order_number_sequence_start,
+ limit_digital_download_count: values.limit_digital_download_count,
+ digital_asset_authorized_clicks: values.digital_asset_authorized_clicks,
+ limit_digital_download_days: values.limit_digital_download_days,
+ digital_asset_authorized_days: values.digital_asset_authorized_days,
+ ...extensionValues,
+ })
+ // Reset FIRST so the form is no longer dirty — otherwise the language
+ // switch below reloads the page while the `beforeunload` dirty-guard is
+ // still armed, triggering the browser's "unsaved changes" prompt. It
+ // also means a retry after a failed custom field save sends only those.
+ form.reset({ ...values, ...extensionValues })
+ pendingLocaleSwitch.current = localeChanged
+ }
+ // Before the language switch, which may reload the page.
+ if (!(await customFields.save())) return
+ pendingLocaleSwitch.current = false
toastManager.add({ type: 'success', title: t('admin.messages.store_settings_updated') })
- // Reset FIRST so the form is no longer dirty — otherwise the language
- // switch below reloads the page while the `beforeunload` dirty-guard is
- // still armed, triggering the browser's "unsaved changes" prompt.
- form.reset({ ...values, ...extensionValues })
// When the admin language was actually changed:
// - a concrete value → adopt it as this admin's own UI language and switch
// the dashboard into it immediately (same as the profile / top-bar);
@@ -293,7 +311,7 @@ function StoreSettingsForm({ store }: { store: Store }) {
}
}
- useFormSubmitShortcut(form, onSubmit)
+ useFormSubmitShortcut(form, onSubmit, { dirty: customFields.isDirty })
// Compute the dynamic timezone option list once. `Intl.supportedValuesOf`
// can be expensive on some browsers; memo keeps re-renders cheap.
@@ -385,7 +403,16 @@ function StoreSettingsForm({ store }: { store: Store }) {
docsPath="settings/store-details"
title={t('admin.pages.settings.store.title')}
description={t('admin.pages.settings.store.subtitle')}
- actions={<FormActions form={form} />}
+ actions={
+ <FormActions
+ form={form}
+ dirty={customFields.isDirty}
+ onDiscard={() => {
+ form.reset()
+ customFields.reset()
+ }}
+ />
+ }
/>
}
main={
@@ -871,6 +898,7 @@ function StoreSettingsForm({ store }: { store: Store }) {
</FieldGroup>
</CardContent>
</Card>
+ <DraftCustomFieldsCard draft={customFields} />
<Slot name="store.form_main" context={{ store }} />
</>
}
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/settings/taxes/rates.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/settings/taxes/rates.tsx
index b8f5c75540..0fe0142786 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/settings/taxes/rates.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/settings/taxes/rates.tsx
@@ -52,6 +52,10 @@ import { useEffect } from 'react'
import { Controller, type UseFormReturn, useForm } from 'react-hook-form'
import { useTranslation } from 'react-i18next'
import { z } from 'zod/v4'
+import {
+ DraftCustomFieldsCard,
+ useCustomFieldsDraft,
+} from '../../../../../components/spree/custom-fields/custom-fields-inline'
import { JurisdictionLabel } from '../../../../../components/spree/jurisdiction-label'
import { SettingsListCard } from '../../../../../components/spree/settings-list-card'
import { TaxCategoryLabel } from '../../../../../components/spree/tax-category-label'
@@ -279,6 +283,7 @@ function EditTaxRateSheet({
const { t } = useTranslation()
const { data: taxRate, isLoading } = useTaxRate(id)
const updateMutation = useUpdateTaxRate(id)
+ const customFields = useCustomFieldsDraft('tax_rate', id)
const form = useForm<TaxRateFormValues>({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -302,11 +307,17 @@ function EditTaxRateSheet({
async function onSubmit(values: TaxRateFormValues) {
try {
- await updateMutation.mutateAsync({
- ...taxRateValuesToParams(values),
- ...extensionSubmitValues('tax_rate', form),
- })
- form.reset(values)
+ // The record saves first and is marked clean, so a retry after a failed
+ // custom field save sends only the custom fields.
+ const savesRecord = form.formState.isDirty
+ if (savesRecord) {
+ await updateMutation.mutateAsync({
+ ...taxRateValuesToParams(values),
+ ...extensionSubmitValues('tax_rate', form),
+ })
+ form.reset(values)
+ }
+ if (!(await customFields.save({ announce: !savesRecord }))) return
onOpenChange(false)
} catch (err) {
if (!mapSpreeErrorsToForm(err, form.setError)) throw err
@@ -333,6 +344,7 @@ function EditTaxRateSheet({
name="tax_rate.form_fields"
context={{ taxRate, mode: 'edit' }}
/>
+ <DraftCustomFieldsCard draft={customFields} hideWhenEmpty />
</div>
<SheetFooter>
<Button
@@ -345,7 +357,9 @@ function EditTaxRateSheet({
</Button>
<Button
type="submit"
- disabled={form.formState.isSubmitting || !form.formState.isDirty}
+ disabled={
+ form.formState.isSubmitting || (!form.formState.isDirty && !customFields.isDirty)
+ }
>
{form.formState.isSubmitting ? t('admin.actions.saving') : t('admin.actions.save')}
</Button>
diff --git a/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/index.tsx b/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/index.tsx
index 3d6c1ca322..1c93c7c3e5 100644
--- a/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/index.tsx
+++ b/packages/dashboard/src/routes/_authenticated/$storeId/transfers/$transferId/index.tsx
@@ -38,6 +38,7 @@ import { createFileRoute, Link, useNavigate } from '@tanstack/react-router'
import { useMemo, useState } from 'react'
import { useTranslation } from 'react-i18next'
import { CloseShortDialog } from '../../../../../components/spree/close-short-dialog'
+import { ApiCustomFieldsCard } from '../../../../../components/spree/custom-fields/custom-fields-inline'
import { InventoryStatusBadge } from '../../../../../components/spree/inventory-status-badge'
import { ReceiveDeliveryCard } from '../../../../../components/spree/receive-delivery-card'
import { ResourceDetailSkeleton } from '../../../../../components/spree/route-pending'
@@ -110,6 +111,7 @@ function StockTransferDetailPage() {
sidebar={
<>
<SummaryCard transfer={transfer} />
+ <ApiCustomFieldsCard ownerType="stock_transfer" ownerId={transfer.id} />
<Slot name="stock_transfer.form_sidebar" context={{ transfer }} />
</>
}
diff --git a/packages/dashboard/src/schemas/custom-field-definition.ts b/packages/dashboard/src/schemas/custom-field-definition.ts
index 91349bfd24..7ae9d2e191 100644
--- a/packages/dashboard/src/schemas/custom-field-definition.ts
+++ b/packages/dashboard/src/schemas/custom-field-definition.ts
@@ -40,26 +40,44 @@ export function fieldTypeLabel(value: string): string {
})
}
-// Owner types that have a first-class admin UI. The server allows more (see
-// `Spree.custom_fields.enabled_resources`); these are the ones admins can pick
-// when defining a field. Extending this is a one-line add — the API already
-// accepts any resource type registered in core.
+// Owner types whose values merchants can edit in the dashboard. The server
+// allows more (see `Spree.custom_fields.enabled_resources`); the definition
+// picker lists those under "Through the API only", since nothing here edits
+// them. A type gains a place here when a screen gets the custom fields card.
export const DEFAULT_RESOURCE_TYPES = [
'product',
'variant',
'order',
'customer',
'category',
+ 'collection',
'option_type',
+ 'seller',
+ 'promotion',
+ 'gift_card',
+ 'store_credit',
+ 'stock_transfer',
+ 'purchase_order',
+ 'company',
+ 'payment_method',
+ 'delivery_method',
+ 'tax_rate',
+ 'product_type',
+ 'media',
+ 'store',
] as const
export type ResourceType = (typeof DEFAULT_RESOURCE_TYPES)[number] | (string & {})
-export function resourceTypeLabel(value: string): string {
- // `defaultValue` humanizes any owner the i18n bundle doesn't enumerate
- // (plugin-defined resource types).
+/**
+ * @param fallback shown for an owner the i18n bundle doesn't enumerate
+ * (plugin-defined resource types) — the server's name for it, when known;
+ * otherwise the value is humanized.
+ */
+export function resourceTypeLabel(value: string, fallback?: string): string {
return i18n.t(`admin.fields.custom_field_definition.resource_type.options.${value}`, {
- defaultValue: value.replace(/_/g, ' ').replace(/^\w/, (letter) => letter.toUpperCase()),
+ defaultValue:
+ fallback ?? value.replace(/_/g, ' ').replace(/^\w/, (letter) => letter.toUpperCase()),
})
}
diff --git a/spree/api/app/controllers/spree/api/v3/admin/custom_fields_controller.rb b/spree/api/app/controllers/spree/api/v3/admin/custom_fields_controller.rb
index b483bcbd6a..60219120e8 100644
--- a/spree/api/app/controllers/spree/api/v3/admin/custom_fields_controller.rb
+++ b/spree/api/app/controllers/spree/api/v3/admin/custom_fields_controller.rb
@@ -64,16 +64,37 @@ module Spree
# store can't read or write custom fields on another store's records.
# Users are intentionally global in Spree (`User.for_store` is a
# no-op), so the store boundary for customer parents is enforced by
- # the `authorize!(:show, @parent)` ability check above.
+ # the `authorize!(:update, @parent)` ability check above.
+ #
+ # Fails closed: `Spree::Base.for_store` answers the bare class when the
+ # store has no association for the model, which would search every
+ # store's records.
def parent_relation
klass = parent_lookup.klass
- klass.respond_to?(:for_store) ? klass.for_store(current_store) : klass
+ return klass.where(id: current_store.id) if klass <= Spree::Store
+ return klass if klass <= Spree.customer_class
+
+ relation = klass.for_store(current_store)
+ raise ActiveRecord::RecordNotFound, 'Parent resource not found' if relation.equal?(klass)
+
+ relation
end
# Product-family parents have no scope pair of their own — their
# custom fields are catalog data, gated by `products` like the rest
# of the variant/option-type surface.
- SCOPE_OVERRIDES = { 'option_type' => :products, 'variant' => :products }.freeze
+ # Parents whose own controller is gated by a scope other than their
+ # plural name share that controller's scope.
+ SCOPE_OVERRIDES = {
+ 'option_type' => :products,
+ 'variant' => :products,
+ 'company' => :customers,
+ 'stock_transfer' => :stock,
+ 'purchase_order' => :purchasing,
+ 'payment_method' => :settings,
+ 'tax_rate' => :settings,
+ 'store' => :settings
+ }.freeze
# Per-parent scope check: a key holding `write_products` may write a
# product's custom fields, `write_orders` may write an order's, etc.
@@ -104,12 +125,13 @@ module Spree
# code reloads — `enabled_resources` is captured at boot and its
# class references go stale. Aliases `'customer'` because the route
# uses `customer_id` while user_class.model_name.element is `'user'`,
- # and `'category'` because the routes expose taxons as categories
- # (5.5 rename) while the model's element is still `'taxon'`.
+ # `'category'` because the routes expose taxons as categories
+ # (5.5 rename) while the model's element is still `'taxon'`, and
+ # `'medium'` because Rails singularizes the `media` route to `medium_id`.
def parent_route_map
@parent_route_map ||= Spree.custom_fields.enabled_resources.each_with_object({}) do |klass, m|
m[klass.model_name.element.to_s] = klass.name
- end.merge('customer' => Spree.customer_class.name, 'category' => 'Spree::Category')
+ end.merge('customer' => Spree.customer_class.name, 'category' => 'Spree::Category', 'medium' => 'Spree::Media')
end
# Returns the first segment whose `<segment>_id` is in the route,
@@ -117,8 +139,8 @@ module Spree
# by both `set_parent` and `scoped_resource_name`.
#
# Read from the path only: a `store_id` or `refund_id` added to the
- # query string or body must not switch the parent to a type that is
- # never routed here and has no store scope to narrow it.
+ # query string or body must not switch the parent away from the record
+ # the route names.
def parent_lookup
return @parent_lookup if defined?(@parent_lookup)
diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rb
index 7e78235223..8c8b817c44 100644
--- a/spree/api/config/routes.rb
+++ b/spree/api/config/routes.rb
@@ -282,6 +282,9 @@ Spree::Core::Engine.add_routes do
resource :store, only: [:show, :update], controller: 'store' do
get :data_sources
end
+ # The store's own custom fields, addressed by its id like every other
+ # parent. The controller only ever resolves the current store.
+ resources :stores, only: [], concerns: :custom_fieldable
# Staff & access (invitations, admin users, roles, API keys)
resources :admin_users, only: [:index, :show, :update, :destroy]
@@ -345,7 +348,7 @@ Spree::Core::Engine.add_routes do
end
# Products
- resources :product_types do
+ resources :product_types, concerns: :custom_fieldable do
post :apply_to_products, on: :member
end
resources :products, concerns: [:custom_fieldable, :translatable] do
@@ -387,7 +390,7 @@ Spree::Core::Engine.add_routes do
# Media library — every file in the store, placed or not. Files are put
# ON a product through the nested media routes above; this is where they
# are uploaded, browsed and deleted.
- resources :media, controller: 'media_library', only: [:index, :show, :create, :update, :destroy] do
+ resources :media, controller: 'media_library', only: [:index, :show, :create, :update, :destroy], concerns: :custom_fieldable do
get :usage, on: :member
end
@@ -422,7 +425,7 @@ Spree::Core::Engine.add_routes do
resources :tax_categories
# Tax Rates — the internal tax provider's configuration
- resources :tax_rates
+ resources :tax_rates, concerns: :custom_fieldable
# Selectable tax engines and their declared limits (discovery only)
resources :tax_providers, only: [:index]
@@ -447,7 +450,7 @@ Spree::Core::Engine.add_routes do
post :bulk_upsert, on: :collection
end
resources :stock_movements, only: [:index, :show]
- resources :stock_transfers do
+ resources :stock_transfers, concerns: :custom_fieldable do
member do
patch :mark_ready
patch :mark_in_transit
@@ -460,7 +463,7 @@ Spree::Core::Engine.add_routes do
# Purchasing
resources :suppliers
- resources :purchase_orders do
+ resources :purchase_orders, concerns: :custom_fieldable do
member do
patch :mark_ordered
patch :mark_draft
@@ -471,7 +474,7 @@ Spree::Core::Engine.add_routes do
end
# Payment Methods
- resources :delivery_methods do
+ resources :delivery_methods, concerns: :custom_fieldable do
collection do
get :calculators
get :fulfillment_providers
@@ -492,7 +495,7 @@ Spree::Core::Engine.add_routes do
only: [:index, :show, :create, :update, :destroy]
end
- resources :payment_methods do
+ resources :payment_methods, concerns: :custom_fieldable do
get :types, on: :collection
end
@@ -502,7 +505,7 @@ Spree::Core::Engine.add_routes do
end
# Promotions, with nested actions/rules/coupon codes.
- resources :promotions do
+ resources :promotions, concerns: :custom_fieldable do
resources :promotion_actions, only: [:index, :show, :create, :update, :destroy]
resources :promotion_rules, only: [:index, :show, :create, :update, :destroy]
resources :coupon_codes, only: [:index, :show]
@@ -635,7 +638,7 @@ Spree::Core::Engine.add_routes do
# Business customers — a tree of company nodes. Nested collections are
# listed and created under their node and then addressed directly, so
# a caller holding an entry id does not have to know its company.
- resources :companies do
+ resources :companies, concerns: :custom_fieldable do
# The node's address book.
resources :addresses, controller: 'companies/addresses'
@@ -720,12 +723,12 @@ Spree::Core::Engine.add_routes do
end
# Gift cards
- resources :gift_cards
+ resources :gift_cards, concerns: :custom_fieldable
resources :gift_card_batches, only: [:index, :show, :create]
# Store credits across all customers. Read-only: issuing, editing and
# deleting a credit stays nested under the customer that holds it.
- resources :store_credits, only: [:index, :show] do
+ resources :store_credits, only: [:index, :show], concerns: :custom_fieldable do
resources :events, only: [:index], controller: 'store_credits/events'
end
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_controller_spec.rb
index ea9d454f09..714dfdc02d 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_controller_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_controller_spec.rb
@@ -207,25 +207,6 @@ RSpec.describe Spree::Api::V3::Admin::CustomFieldsController, type: :controller
end
end
- # The parent comes from the route: a `store_id` in the query string must not
- # switch it to a store, which has no store scope to narrow it.
- describe 'a parent named outside the route' do
- let(:category) { create(:category) }
- let(:category_definition) { create(:custom_field_definition, :short_text_field, resource_type: 'Spree::Category') }
-
- it 'keeps the routed parent' do
- post :create,
- params: {
- category_id: category.prefixed_id, store_id: create(:store).prefixed_id,
- custom_field_definition_id: category_definition.prefixed_id, value: 'summer'
- },
- as: :json
-
- expect(response).to have_http_status(:created)
- expect(category.custom_fields.pluck(:value)).to eq(['summer'])
- end
- end
-
describe 'API key scope enforcement' do
let(:api_key) { create(:api_key, :secret, store: store, scopes: [granted_scope]) }
let(:api_key_headers) { { 'x-spree-api-key' => api_key.plaintext_token } }
@@ -311,6 +292,28 @@ RSpec.describe Spree::Api::V3::Admin::CustomFieldsController, type: :controller
end
end
+ context 'with a payment method parent' do
+ # Shares the scope of the payment methods controller rather than an
+ # ungrantable `payment_methods` one.
+ let(:granted_scope) { 'write_settings' }
+ let(:payment_method) { create(:check_payment_method) }
+ let(:payment_method_definition) do
+ create(:custom_field_definition, :short_text_field, resource_type: 'Spree::PaymentMethod')
+ end
+
+ it 'gates by the settings scope' do
+ post :create,
+ params: {
+ payment_method_id: payment_method.prefixed_id,
+ custom_field_definition_id: payment_method_definition.prefixed_id,
+ value: 'NET30'
+ },
+ as: :json
+
+ expect(response).to have_http_status(:created)
+ end
+ end
+
context 'with a category parent' do
# Regression: the parent map keyed taxons by `category`, but the routes
# expose `category_id` — category custom-field endpoints 404'd for
diff --git a/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_polymorphic_parent_spec.rb b/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_polymorphic_parent_spec.rb
index d4f1456abd..31dc5d5d9b 100644
--- a/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_polymorphic_parent_spec.rb
+++ b/spree/api/spec/controllers/spree/api/v3/admin/custom_fields_polymorphic_parent_spec.rb
@@ -10,9 +10,11 @@ RSpec.describe Spree::Api::V3::Admin::CustomFieldsController, type: :controller
before { request.headers.merge!(headers) }
- shared_examples 'parent-from-route inference' do |parent_factory:, definition_trait:, param_key:|
+ shared_examples 'parent-from-route inference' do |parent_factory:, param_key:, definition_trait: nil, resource_type: nil|
let!(:parent) { create(parent_factory) }
- let!(:definition) { create(:custom_field_definition, definition_trait) }
+ let!(:definition) do
+ definition_trait ? create(:custom_field_definition, definition_trait) : create(:custom_field_definition, resource_type: resource_type)
+ end
let!(:custom_field) do
create(:custom_field, resource: parent, custom_field_definition: definition,
type: definition.field_type_class_name,
@@ -49,6 +51,61 @@ RSpec.describe Spree::Api::V3::Admin::CustomFieldsController, type: :controller
param_key: :variant_id
end
+ {
+ promotions: [:promotion, :promotion_id, 'Spree::Promotion'],
+ gift_cards: [:gift_card, :gift_card_id, 'Spree::GiftCard'],
+ store_credits: [:store_credit, :store_credit_id, 'Spree::StoreCredit'],
+ stock_transfers: [:stock_transfer, :stock_transfer_id, 'Spree::StockTransfer'],
+ purchase_orders: [:purchase_order, :purchase_order_id, 'Spree::PurchaseOrder'],
+ companies: [:company, :company_id, 'Spree::Company'],
+ payment_methods: [:check_payment_method, :payment_method_id, 'Spree::PaymentMethod'],
+ delivery_methods: [:delivery_method, :delivery_method_id, 'Spree::DeliveryMethod'],
+ tax_rates: [:tax_rate, :tax_rate_id, 'Spree::TaxRate'],
+ product_types: [:product_type, :product_type_id, 'Spree::ProductType'],
+ media: [:media, :medium_id, 'Spree::Media']
+ }.each do |name, (parent_factory, param_key, resource_type)|
+ describe name.to_s do
+ include_examples 'parent-from-route inference',
+ parent_factory: parent_factory, param_key: param_key, resource_type: resource_type
+ end
+ end
+
+ describe 'the store' do
+ let!(:definition) { create(:custom_field_definition, resource_type: 'Spree::Store') }
+
+ it 'writes custom fields on the current store' do
+ post :create,
+ params: { store_id: store.prefixed_id, custom_field_definition_id: definition.prefixed_id, value: 'EU' },
+ as: :json
+
+ expect(response).to have_http_status(:created)
+ expect(store.custom_fields.pluck(:value)).to eq(['EU'])
+ end
+
+ it 'does not reach another store' do
+ other_store = create(:store)
+
+ get :index, params: { store_id: other_store.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+
+ # `Spree::Base.for_store` answers the bare class when the store has no
+ # association for a model; the lookup must refuse rather than search every
+ # store's records.
+ describe 'a parent the store cannot scope' do
+ let!(:promotion) { create(:promotion) }
+
+ before { allow(Spree::Promotion).to receive(:for_store).and_return(Spree::Promotion) }
+
+ it 'returns not found' do
+ get :index, params: { promotion_id: promotion.prefixed_id }, as: :json
+
+ expect(response).to have_http_status(:not_found)
+ end
+ end
+
# Simulates the dev-mode class-reload condition where
# `enabled_resources.include?(Spree.customer_class)` returns false because the
# cached class reference goes stale after Zeitwerk reloads. The customer
diff --git a/spree/api/spec/integration/spree/api/v3/admin/custom_fields_spec.rb b/spree/api/spec/integration/spree/api/v3/admin/custom_fields_spec.rb
index 71d1968756..a4769cda39 100644
--- a/spree/api/spec/integration/spree/api/v3/admin/custom_fields_spec.rb
+++ b/spree/api/spec/integration/spree/api/v3/admin/custom_fields_spec.rb
@@ -16,7 +16,19 @@ RSpec.describe 'Admin Custom Fields API', type: :request, swagger_doc: 'api-refe
'option_types' => { tag: 'Option Types', scope: :products, label: 'option type', parent: -> { create(:option_type) } },
'orders' => { tag: 'Orders', scope: :orders, label: 'order', parent: -> { create(:order, store: store) } },
'sellers' => { tag: 'Sellers', scope: :sellers, label: 'seller', parent: -> { create(:seller, store: store) } },
- 'variants' => { tag: 'Variants', scope: :products, label: 'variant', parent: -> { create(:variant) } }
+ 'variants' => { tag: 'Variants', scope: :products, label: 'variant', parent: -> { create(:variant) } },
+ 'promotions' => { tag: 'Promotions', scope: :promotions, label: 'promotion', parent: -> { create(:promotion) } },
+ 'gift_cards' => { tag: 'Gift Cards', scope: :gift_cards, label: 'gift card', parent: -> { create(:gift_card) } },
+ 'store_credits' => { tag: 'Store Credits', scope: :store_credits, label: 'store credit', parent: -> { create(:store_credit) } },
+ 'stock_transfers' => { tag: 'Stock Transfers', scope: :stock, label: 'stock transfer', parent: -> { create(:stock_transfer) } },
+ 'purchase_orders' => { tag: 'Purchase Orders', scope: :purchasing, label: 'purchase order', parent: -> { create(:purchase_order) } },
+ 'companies' => { tag: 'Companies', scope: :customers, label: 'company', parent: -> { create(:company) } },
+ 'payment_methods' => { tag: 'Payment Methods', scope: :settings, label: 'payment method', parent: -> { create(:check_payment_method) } },
+ 'delivery_methods' => { tag: 'Delivery', scope: :delivery_methods, label: 'delivery method', parent: -> { create(:delivery_method) } },
+ 'tax_rates' => { tag: 'Settings', scope: :settings, label: 'tax rate', parent: -> { create(:tax_rate) } },
+ 'product_types' => { tag: 'Product Types', scope: :product_types, label: 'product type', parent: -> { create(:product_type) } },
+ 'media' => { tag: 'Media', scope: :media, label: 'media file', parent: -> { create(:media) } },
+ 'stores' => { tag: 'Settings', scope: :settings, label: 'store', parent: -> { store } }
}.each do |segment, config|
parent_param = :"#{segment.singularize}_id"
@@ -43,7 +55,7 @@ RSpec.describe 'Admin Custom Fields API', type: :request, swagger_doc: 'api-refe
let(:'x-spree-api-key') { secret_api_key.plaintext_token }
let(:parent) { instance_exec(&config[:parent]) }
let(:definition) do
- create(:custom_field_definition, :short_text_field, resource_type: parent.class.name)
+ create(:custom_field_definition, :short_text_field, resource_type: parent.class.base_class.name)
end
let!(:custom_field) do
create(:custom_field, resource: parent, custom_field_definition: definition, value: 'wool')
diff --git a/spree/api/spec/requests/spree/api/v3/admin/custom_fields_spec.rb b/spree/api/spec/requests/spree/api/v3/admin/custom_fields_spec.rb
new file mode 100644
index 0000000000..968ec6ed21
--- /dev/null
+++ b/spree/api/spec/requests/spree/api/v3/admin/custom_fields_spec.rb
@@ -0,0 +1,20 @@
+require 'spec_helper'
+
+# The parent comes from the route. A controller spec cannot show that: it
+# routes every param it is given, so a `store_id` there picks the store route.
+RSpec.describe 'Admin custom fields parent', type: :request do
+ include_context 'API v3 Admin'
+
+ let(:category) { create(:category) }
+ let(:definition) { create(:custom_field_definition, :short_text_field, resource_type: 'Spree::Category') }
+
+ it 'keeps the routed parent when the query string names a store' do
+ post "/api/v3/admin/categories/#{category.prefixed_id}/custom_fields?store_id=#{create(:store).prefixed_id}",
+ params: { custom_field_definition_id: definition.prefixed_id, value: 'summer' },
+ headers: bearer_headers,
+ as: :json
+
+ expect(response).to have_http_status(:created)
+ expect(category.custom_fields.pluck(:value)).to eq(['summer'])
+ end
+end
diff --git a/spree/core/lib/spree/core/engine.rb b/spree/core/lib/spree/core/engine.rb
index 98af26773e..7199d5c9e2 100644
--- a/spree/core/lib/spree/core/engine.rb
+++ b/spree/core/lib/spree/core/engine.rb
@@ -506,6 +506,7 @@ module Spree
Spree::Address,
Spree::Claim,
Spree::Collection,
+ Spree::Company,
Spree::CreditCard,
Spree::Exchange,
Spree::GiftCard,
@@ -521,6 +522,7 @@ module Spree
Spree::Product,
Spree::ProductType,
Spree::Promotion,
+ Spree::PurchaseOrder,
Spree::Refund,
Spree::Return,
Spree::Fulfillment,