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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Take catalog merchandising off the seller product form
Damian Legawiec7de43b015266
diff --git a/docs/api-reference/admin.yaml b/docs/api-reference/admin.yamlindex d06bd33f9c..181604b025 100644--- a/docs/api-reference/admin.yaml+++ b/docs/api-reference/admin.yaml@@ -356,6 +356,9 @@ paths:- write_store_credits- read_products- write_products+ - read_product_types+ - read_publishing+ - write_publishing- read_media- write_media- read_categories@@ -481,6 +484,9 @@ paths:- write_store_credits- read_products- write_products+ - read_product_types+ - read_publishing+ - write_publishing- read_media- write_media- read_categories@@ -20016,15 +20022,15 @@ paths:label: Countrydescription:preference_schema:- - key: country_code- type: string- default:- key: country_codestype: arraydefault: []- key: country_idtype: integerdefault:+ - key: country_code+ type: string+ default:- type: currencylabel: Currencydescription:@@ -20051,18 +20057,18 @@ paths:label: Item totaldescription:preference_schema:- - key: amount_min- type: decimal- default: 100.0- - key: operator_min- type: string- default: ">"- key: amount_maxtype: decimaldefault:- key: operator_maxtype: stringdefault: "<"+ - key: amount_min+ type: decimal+ default: 100.0+ - key: operator_min+ type: string+ default: ">"- type: marketlabel: Market(s)description:@@ -22246,6 +22252,27 @@ paths:group_label: Cataloglabel: Productsdescription: Products, variants, options, prices and media+ - key: read_product_types+ resource: product_types+ kind: read+ group: catalog+ group_label: Catalog+ label: Product types+ description: ''+ - key: read_publishing+ resource: publishing+ kind: read+ group: catalog+ group_label: Catalog+ label: Publishing+ description: ''+ - key: write_publishing+ resource: publishing+ kind: write+ group: catalog+ group_label: Catalog+ label: Publishing+ description: ''- key: read_mediaresource: mediakind: read@@ -22450,7 +22477,7 @@ paths:label: Analytics dashboarddescription: Sales and performance analyticsmeta:- count: 43+ count: 46"/api/v3/admin/roles":get:summary: List roles@@ -22516,6 +22543,9 @@ paths:- write_store_credits- read_products- write_products+ - read_product_types+ - read_publishing+ - write_publishing- read_media- write_media- read_categories@@ -26647,10 +26677,10 @@ paths:name: Sale valuedescription: Charges this rate only on sales within a value rangepreference_schema:- - key: min_amount+ - key: max_amounttype: decimaldefault:- - key: max_amount+ - key: min_amounttype: decimaldefault:association_fields: []@@ -29102,15 +29132,15 @@ paths:- type: Spree::Calculator::Shipping::PerItemname: Flat rate per package itempreference_schema:- - key: currency- type: string- default: USD- key: amountstype: hashdefault: {}- key: amounttype: decimaldefault: 0+ - key: currency+ type: string+ default: USD- type: Spree::Calculator::Shipping::PriceSackname: Price sackpreference_schema:@@ -29129,15 +29159,15 @@ paths:- type: Spree::Calculator::Shipping::DigitalDeliveryname: Digital Deliverypreference_schema:- - key: currency- type: string- default: USD- key: amountstype: hashdefault: {}- key: amounttype: decimaldefault: 0+ - key: currency+ type: string+ default: USD"/api/v3/admin/delivery_zones":post:summary: Create delivery zone@@ -30363,8 +30393,8 @@ paths:name: Accept termsdescription: The seller has accepted your marketplace termspreferences:- terms_effective_from:terms_url:+ terms_effective_from:custom_field_definition_ids: []allow_multiple: falseaccepts_submissions: false@@ -30586,10 +30616,10 @@ paths:accepted_content_types: []association_fields: []preference_schema:- - key: terms_effective_from+ - key: terms_urltype: stringdefault:- - key: terms_url+ - key: terms_effective_fromtype: stringdefault:- type: complete_profilediff --git a/docs/api-reference/seller.yaml b/docs/api-reference/seller.yamlindex 8e65295fa4..1f2a61067f 100644--- a/docs/api-reference/seller.yaml+++ b/docs/api-reference/seller.yaml@@ -405,13 +405,6 @@ paths:subjects:- Spree::Producthas_conditions: false- - allow: true- actions:- - read- - admin- subjects:- - Spree::ProductType- has_conditions: false- allow: trueactions:- read@@ -454,13 +447,6 @@ paths:subjects:- Spree::PriceRulehas_conditions: false- - allow: true- actions:- - read- - admin- subjects:- - Spree::ProductPublication- has_conditions: false- allow: trueactions:- read@@ -474,12 +460,6 @@ paths:subjects:- Spree::Producthas_conditions: false- - allow: true- actions:- - manage- subjects:- - Spree::ProductType- has_conditions: false- allow: trueactions:- manage@@ -516,12 +496,6 @@ paths:subjects:- Spree::PriceRulehas_conditions: false- - allow: true- actions:- - manage- subjects:- - Spree::ProductPublication- has_conditions: false- allow: trueactions:- manage@@ -12431,6 +12405,7 @@ paths:original_price:seller_id: sel_UkLWZg9DAJstatus: active+ metadata: {}created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'meta:@@ -12515,6 +12490,7 @@ paths:original_price:seller_id: sel_UkLWZg9DAJstatus: draft+ metadata: {}created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'schema:@@ -12664,6 +12640,7 @@ paths:original_price:seller_id: sel_UkLWZg9DAJstatus: active+ metadata: {}created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'schema:@@ -12736,6 +12713,7 @@ paths:original_price:seller_id: sel_UkLWZg9DAJstatus: active+ metadata: {}created_at: '2026-01-15T12:00:00.000Z'updated_at: '2026-01-15T12:00:00.000Z'schema:@@ -12829,6 +12807,11 @@ paths:minimum_payout_amount:on_holiday: falsesellable: true+ default_currency: USD+ supported_currencies:+ - USD+ - EUR+ - GBPproducts_count: 0tax_identifiers: []schema:@@ -12901,6 +12884,11 @@ paths:minimum_payout_amount:on_holiday: falsesellable: true+ default_currency: USD+ supported_currencies:+ - USD+ - EUR+ - GBPproducts_count: 0tax_identifiers: []schema:@@ -14971,89 +14959,6 @@ components:- key- valuex-typelizer: true- Media:- type: object- properties:- id:- type: string- product_id:- type: string- nullable: true- variant_ids:- type: array- items:- type: string- position:- type: number- alt:- type: string- nullable: true- media_type:- type: string- focal_point_x:- type: number- nullable: true- focal_point_y:- type: number- nullable: true- external_video_url:- type: string- nullable: true- video_provider:- type: string- nullable: true- video_embed_url:- type: string- nullable: true- video_url:- type: string- nullable: true- poster_url:- type: string- nullable: true- original_url:- type: string- nullable: true- mini_url:- type: string- nullable: true- small_url:- type: string- nullable: true- medium_url:- type: string- nullable: true- large_url:- type: string- nullable: true- xlarge_url:- type: string- nullable: true- og_image_url:- type: string- nullable: true- required:- - id- - product_id- - variant_ids- - position- - alt- - media_type- - focal_point_x- - focal_point_y- - external_video_url- - video_provider- - video_embed_url- - video_url- - poster_url- - original_url- - mini_url- - small_url- - medium_url- - large_url- - xlarge_url- - og_image_url- x-typelizer: trueOptionType:type: objectproperties:@@ -15283,6 +15188,95 @@ components:- status- acceptance_urlx-typelizer: true+ Media:+ type: object+ properties:+ id:+ type: string+ product_id:+ type: string+ nullable: true+ variant_ids:+ type: array+ items:+ type: string+ position:+ type: number+ alt:+ type: string+ nullable: true+ media_type:+ type: string+ focal_point_x:+ type: number+ nullable: true+ focal_point_y:+ type: number+ nullable: true+ external_video_url:+ type: string+ nullable: true+ video_provider:+ type: string+ nullable: true+ video_embed_url:+ type: string+ nullable: true+ video_url:+ type: string+ nullable: true+ poster_url:+ type: string+ nullable: true+ original_url:+ type: string+ nullable: true+ mini_url:+ type: string+ nullable: true+ small_url:+ type: string+ nullable: true+ medium_url:+ type: string+ nullable: true+ large_url:+ type: string+ nullable: true+ xlarge_url:+ type: string+ nullable: true+ og_image_url:+ type: string+ nullable: true+ created_at:+ type: string+ updated_at:+ type: string+ required:+ - id+ - product_id+ - variant_ids+ - position+ - alt+ - media_type+ - focal_point_x+ - focal_point_y+ - external_video_url+ - video_provider+ - video_embed_url+ - video_url+ - poster_url+ - original_url+ - mini_url+ - small_url+ - medium_url+ - large_url+ - xlarge_url+ - og_image_url+ - created_at+ - updated_at+ x-typelizer: trueOrderLineItem:type: objectproperties:@@ -15516,6 +15510,8 @@ components:nullable: truestatus:type: string+ metadata:+ type: objectcreated_at:type: stringupdated_at:@@ -15545,6 +15541,7 @@ components:- original_price- seller_id- status+ - metadata- created_at- updated_atx-typelizer: true@@ -15604,6 +15601,12 @@ components:type: booleansellable:type: boolean+ default_currency:+ type: string+ supported_currencies:+ type: array+ items:+ type: stringproducts_count:type: numbertax_identifiers:@@ -15636,6 +15639,8 @@ components:- minimum_payout_amount- on_holiday- sellable+ - default_currency+ - supported_currencies- products_count- tax_identifiersx-typelizer: true@@ -15758,6 +15763,42 @@ components:- file_url- file_namex-typelizer: true+ StockLevel:+ type: object+ properties:+ id:+ type: string+ count_on_hand:+ type: number+ backorderable:+ type: boolean+ stock_location_id:+ type: string+ nullable: true+ variant_id:+ type: string+ nullable: true+ created_at:+ type: string+ updated_at:+ type: string+ allocated_count:+ type: number+ available_count:+ type: number+ stock_location:+ "$ref": "#/components/schemas/StockLocation"+ required:+ - id+ - count_on_hand+ - backorderable+ - stock_location_id+ - variant_id+ - created_at+ - updated_at+ - allocated_count+ - available_count+ x-typelizer: trueStockLocation:type: objectproperties:@@ -15888,38 +15929,6 @@ components:- created_at- avatar_urlx-typelizer: true- Seller:- type: object- properties:- id:- type: string- name:- type: string- slug:- type: string- about:- type: string- about_html:- type: string- logo_url:- type: string- nullable: true- square_logo_url:- type: string- nullable: true- cover_photo_url:- type: string- nullable: true- required:- - id- - name- - slug- - about- - about_html- - logo_url- - square_logo_url- - cover_photo_url- x-typelizer: trueVariant:type: objectproperties:@@ -15991,6 +16000,57 @@ components:allOf:- "$ref": "#/components/schemas/PriceHistory"nullable: true+ metadata:+ type: object+ position:+ type: number+ cost_price:+ type: string+ nullable: true+ cost_currency:+ type: string+ nullable: true+ barcode:+ type: string+ nullable: true+ weight_unit:+ type: string+ nullable: true+ dimensions_unit:+ type: string+ nullable: true+ backorder_limit:+ type: number+ nullable: true+ hs_code:+ type: string+ nullable: true+ country_of_origin:+ type: string+ nullable: true+ customs_description:+ type: string+ nullable: true+ created_at:+ type: string+ updated_at:+ type: string+ preorderable:+ type: boolean+ available_stock:+ type: number+ nullable: true+ total_on_hand:+ type: number+ nullable: true+ prices:+ type: array+ items:+ "$ref": "#/components/schemas/Price"+ stock_levels:+ type: array+ items:+ "$ref": "#/components/schemas/StockLevel"required:- id- product_id@@ -16012,4 +16072,52 @@ components:- original_price- seller_id- option_values+ - metadata+ - position+ - cost_price+ - cost_currency+ - barcode+ - weight_unit+ - dimensions_unit+ - backorder_limit+ - hs_code+ - country_of_origin+ - customs_description+ - created_at+ - updated_at+ - preorderable+ - available_stock+ - total_on_hand+ x-typelizer: true+ Seller:+ type: object+ properties:+ id:+ type: string+ name:+ type: string+ slug:+ type: string+ about:+ type: string+ about_html:+ type: string+ logo_url:+ type: string+ nullable: true+ square_logo_url:+ type: string+ nullable: true+ cover_photo_url:+ type: string+ nullable: true+ required:+ - id+ - name+ - slug+ - about+ - about_html+ - logo_url+ - square_logo_url+ - cover_photo_urlx-typelizer: truediff --git a/packages/dashboard-core/src/products/variants-options-builder.tsx b/packages/dashboard-core/src/products/variants-options-builder.tsxindex 25dacac313..8a68e74b5f 100644--- a/packages/dashboard-core/src/products/variants-options-builder.tsx+++ b/packages/dashboard-core/src/products/variants-options-builder.tsx@@ -14,7 +14,7 @@ import {import { CheckIcon, PencilIcon, PlusIcon, XIcon } from 'lucide-react'import { useMemo, useState } from 'react'import { useTranslation } from 'react-i18next'-import type { PanelOptionType as OptionType } from '../api-client'+import { getApiClient, type PanelOptionType as OptionType } from '../api-client'import {useCreateOptionType,useFormOptionTypes as useOptionTypes,@@ -205,6 +205,7 @@ function AddOptionForm({ availableTypes, allOptionTypes, onSave, onCancel }: Addconst [pickedTypeId, setPickedTypeId] = useState<string>('')const [creatingType, setCreatingType] = useState(false)const createOptionType = useCreateOptionType()+ const canCreateOptionType = Boolean(getApiClient().optionTypes?.create)const picked =allOptionTypes.find((ot) => ot.id === pickedTypeId) ??@@ -247,11 +248,23 @@ function AddOptionForm({ availableTypes, allOptionTypes, onSave, onCancel }: Add</SelectContent></Select></Field>- <div className="flex items-center justify-between gap-2">- <Button type="button" variant="ghost" size="sm" onClick={() => setCreatingType(true)}>- <PlusIcon />- {t('admin.products.variants.create_option_type')}- </Button>+ <div className="flex items-center justify-end gap-2">+ {/* Option types are the store's own vocabulary, so only a panel whose+ client can write them offers to add one. A seller picks from what+ the marketplace already defines+ (docs/plans/6.0-seller-product-submission.md). */}+ {canCreateOptionType && (+ <Button+ type="button"+ variant="ghost"+ size="sm"+ className="mr-auto"+ onClick={() => setCreatingType(true)}+ >+ <PlusIcon />+ {t('admin.products.variants.create_option_type')}+ </Button>+ )}<Button type="button" variant="outline" size="sm" onClick={onCancel}>{t('admin.actions.cancel')}</Button>diff --git a/packages/dashboard/src/api-client-setup.ts b/packages/dashboard/src/api-client-setup.tsindex f03ab6ff2e..6058c9e063 100644--- a/packages/dashboard/src/api-client-setup.ts+++ b/packages/dashboard/src/api-client-setup.ts@@ -31,6 +31,8 @@ setApiClient({// Reference data for the shared product form.optionTypes: {list: (params) => adminClient.optionTypes.list({ ...params, expand: ['option_values'] }),+ create: (params) => adminClient.optionTypes.create(params as never),+ update: (id, params) => adminClient.optionTypes.update(id, params as never),},categories: { list: (params) => adminClient.categories.list(params) },collections: { list: (params) => adminClient.collections.list(params) },diff --git a/packages/seller-dashboard/src/api-client.ts b/packages/seller-dashboard/src/api-client.tsindex e01157576d..1ccaa7729b 100644--- a/packages/seller-dashboard/src/api-client.ts+++ b/packages/seller-dashboard/src/api-client.ts@@ -65,15 +65,10 @@ export function createSellerApiClient({create: (params) => sellerClient().stockLocations.create(params),update: (id, params) => sellerClient().stockLocations.update(id, params),},- // Reference data for the shared product form. No `optionTypes`: the- // Seller API has no such endpoint, and a seller names their own options- // on the variant rather than picking from the marketplace's list.- categories: { list: (params) => sellerClient().categories.list(params) },- collections: { list: (params) => sellerClient().collections.list(params) },- productTypes: {- list: (params) => sellerClient().productTypes.list(params),- get: (id) => sellerClient().productTypes.get(id),- },+ // No catalog reference data is registered: how a product is filed — its+ // type, categories, collections and tags — is the marketplace's own+ // merchandising, so the shared form's Categorization card has nothing to+ // read and hides (docs/plans/6.0-seller-product-submission.md).})return clientdiff --git a/packages/seller-dashboard/src/pages/product.tsx b/packages/seller-dashboard/src/pages/product.tsxindex 504abc6390..903a88d26f 100644--- a/packages/seller-dashboard/src/pages/product.tsx+++ b/packages/seller-dashboard/src/pages/product.tsx@@ -1,6 +1,5 @@import { zodResolver } from '@hookform/resolvers/zod'import {- CategorizationCard,GeneralCard,InventoryCard,MediaCard,@@ -27,7 +26,7 @@ import { ProductStatusCard } from '../components/product-status-card'import { RetryableError } from '../components/retryable-error'/** Everything the form edits, in one request. */-const PRODUCT_EXPAND = 'variants,media,default_variant,custom_fields'+const PRODUCT_EXPAND = 'variants,media,default_variant'/*** One product, created or edited.@@ -90,10 +89,6 @@ export function ProductPage({ mode }: { mode: 'new' | 'edit' }) {slug: values.slug || undefined,meta_title: values.meta_title ?? undefined,meta_description: values.meta_description ?? undefined,- product_type_id: values.product_type_id ?? undefined,- category_ids: values.category_ids,- collection_ids: values.collection_ids,- custom_fields: values.custom_fields,// Both lists are the whole intent: anything the seller removed is// absent here, which is what tells the API to drop it.media: (values.media ?? []).map((item) => ({@@ -203,7 +198,6 @@ export function ProductPage({ mode }: { mode: 'new' | 'edit' }) {}}/>)}- <CategorizationCard form={form} /></>}/>diff --git a/packages/seller-sdk/src/seller-client.ts b/packages/seller-sdk/src/seller-client.tsindex 1dd98b19c0..2b8e8aab91 100644--- a/packages/seller-sdk/src/seller-client.ts+++ b/packages/seller-sdk/src/seller-client.ts@@ -2,13 +2,10 @@ import type { ListParams, PaginatedResponse, RequestFn, RequestOptions } from '@import { transformListParams } from '@spree/sdk-core'import type {AuthTokens,- Category,- Collection,Fulfillment,Invitation,Order,Product,- ProductType,Profile,RequirementStatus,RequirementSubmission,@@ -247,50 +244,6 @@ export class SellerClient {this.request<Product>('PATCH', `/products/${id}/archive`, options),}- /**- * The types a seller may list against, and the custom fields each asks- * them to fill in. Read only — defining a type is the operator's.- */- readonly productTypes = {- list: (- params?: ListParams & Record<string, unknown>,- options?: RequestOptions,- ): Promise<PaginatedResponse<ProductType>> =>- this.request<PaginatedResponse<ProductType>>('GET', '/product_types', {- ...options,- params: params ? transformListParams(params) : undefined,- }),-- get: (id: string, options?: RequestOptions): Promise<ProductType> =>- this.request<ProductType>('GET', `/product_types/${id}`, options),- }-- /**- * What a seller may file a product under. Read only — the marketplace owns- * its own taxonomy and merchandising.- */- readonly categories = {- list: (- params?: ListParams & Record<string, unknown>,- options?: RequestOptions,- ): Promise<PaginatedResponse<Category>> =>- this.request<PaginatedResponse<Category>>('GET', '/categories', {- ...options,- params: params ? transformListParams(params) : undefined,- }),- }-- readonly collections = {- list: (- params?: ListParams & Record<string, unknown>,- options?: RequestOptions,- ): Promise<PaginatedResponse<Collection>> =>- this.request<PaginatedResponse<Collection>>('GET', '/collections', {- ...options,- params: params ? transformListParams(params) : undefined,- }),- }-/*** What this seller has sold. A basket spanning several sellers is split* into one order each, so these are the seller's own orders rather than a@@ -454,12 +407,7 @@ export interface ProductParams {meta_title?: stringmeta_description?: stringmeta_keywords?: string- product_type_id?: string- tags?: string[]- category_ids?: string[]- collection_ids?: string[]metadata?: Record<string, unknown>- custom_fields?: Array<{ id?: string; custom_field_definition_id?: string; value?: unknown }>/*** The gallery, as a whole. A file absent from the list is removed, so send* every image the product should end up with. `signed_id` attaches a freshdiff --git a/packages/seller-sdk/src/types/generated/Collection.ts b/packages/seller-sdk/src/types/generated/Collection.tsdeleted file mode 100644index 2c4e5405fd..0000000000--- a/packages/seller-sdk/src/types/generated/Collection.ts+++ /dev/null@@ -1,23 +0,0 @@-// Typelizer digest a7e6fd6063a93a58924c567439e30449-//-// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {CustomField} from '@/types'--type Collection = {- id: string;- name: string;- permalink: string;- position: number;- sort_order: string;- meta_title: string | null;- meta_description: string | null;- meta_keywords: string | null;- products_count: number;- description: string;- description_html: string;- image_url: string | null;- square_image_url: string | null;- custom_fields?: Array<CustomField>;-}--export default Collection;diff --git a/packages/seller-sdk/src/types/generated/CustomField.ts b/packages/seller-sdk/src/types/generated/CustomField.tsindex 84bccba7f8..7359ba30c0 100644--- a/packages/seller-sdk/src/types/generated/CustomField.ts+++ b/packages/seller-sdk/src/types/generated/CustomField.ts@@ -1,4 +1,4 @@-// Typelizer digest c42b787a238a8a2d15d53804af4ee312+// Typelizer digest 56b576d6ef0d9c0fb9565241c1a2e115//// DO NOT MODIFY: This file was automatically generated by Typelizer.@@ -10,7 +10,6 @@ type CustomField = {field_type: 'short_text' | 'long_text' | 'rich_text' | 'number' | 'boolean' | 'json';key: string;value: any;- custom_field_definition_id: string | null;}export default CustomField;diff --git a/packages/seller-sdk/src/types/generated/Product.ts b/packages/seller-sdk/src/types/generated/Product.tsindex 9b64b85053..24ba2519a6 100644--- a/packages/seller-sdk/src/types/generated/Product.ts+++ b/packages/seller-sdk/src/types/generated/Product.ts@@ -1,4 +1,4 @@-// Typelizer digest a29fb25825f9c5c551d1cf86b5459bc7+// Typelizer digest 7959e0fec5cc441c1e8841ad054c232d//// DO NOT MODIFY: This file was automatically generated by Typelizer.import type {Price, PriceHistory, Seller, Media, Variant, OptionType, OptionValue, Category, CustomField} from '@/types'@@ -41,9 +41,6 @@ type Product = {metadata: Record<string, unknown>;created_at: string;updated_at: string;- product_type_id: string | null;- category_ids: Array<string>;- collection_ids: Array<string>;}export default Product;diff --git a/packages/seller-sdk/src/types/generated/ProductType.ts b/packages/seller-sdk/src/types/generated/ProductType.tsdeleted file mode 100644index c5fd6aa991..0000000000--- a/packages/seller-sdk/src/types/generated/ProductType.ts+++ /dev/null@@ -1,12 +0,0 @@-// Typelizer digest ff94661cfa2e3ea366ee05fc7f683f16-//-// DO NOT MODIFY: This file was automatically generated by Typelizer.-import type {ProductTypeCustomFieldDefinition} from '@/types'--type ProductType = {- id: string;- name: string;- custom_field_definitions: Array<ProductTypeCustomFieldDefinition>;-}--export default ProductType;diff --git a/packages/seller-sdk/src/types/generated/ProductTypeCustomFieldDefinition.ts b/packages/seller-sdk/src/types/generated/ProductTypeCustomFieldDefinition.tsdeleted file mode 100644index 0255f3c2d7..0000000000--- a/packages/seller-sdk/src/types/generated/ProductTypeCustomFieldDefinition.ts+++ /dev/null@@ -1,15 +0,0 @@-// Typelizer digest 076da32800ce2f65740f68e41950d330-//-// DO NOT MODIFY: This file was automatically generated by Typelizer.--type ProductTypeCustomFieldDefinition = {- id: string;- key: string;- namespace: string;- label: string;- field_type: 'short_text' | 'long_text' | 'rich_text' | 'number' | 'boolean' | 'json';- required: boolean;- sort_order: number;-}--export default ProductTypeCustomFieldDefinition;diff --git a/packages/seller-sdk/src/types/generated/Variant.ts b/packages/seller-sdk/src/types/generated/Variant.tsindex 7f6b614b76..6c2313557a 100644--- a/packages/seller-sdk/src/types/generated/Variant.ts+++ b/packages/seller-sdk/src/types/generated/Variant.ts@@ -1,4 +1,4 @@-// Typelizer digest 723177d485cf3f14db8cf9b40ad36baf+// Typelizer digest 7e8689f5d3ff50caf13cd78271a24d67//// DO NOT MODIFY: This file was automatically generated by Typelizer.import type {Price, PriceHistory, Seller, Media, OptionValue, CustomField, StockLevel} from '@/types'diff --git a/packages/seller-sdk/src/types/generated/index.ts b/packages/seller-sdk/src/types/generated/index.tsindex a50094e113..d6be501dff 100644--- a/packages/seller-sdk/src/types/generated/index.ts+++ b/packages/seller-sdk/src/types/generated/index.ts@@ -1,14 +1,13 @@-// Typelizer digest 52261024024d062f92f5e55ba3fd4ab8+// Typelizer digest 3975d4ce5c1017989a617aa3676f6ab6//// DO NOT MODIFY: This file was automatically generated by Typelizer.export type { default as Address } from './Address'+export type { default as Category } from './Category'+export type { default as CustomField } from './CustomField'export type { default as OptionType } from './OptionType'export type { default as OptionValue } from './OptionValue'export type { default as PriceHistory } from './PriceHistory'export type { default as Price } from './Price'-export type { default as Category } from './Category'-export type { default as Collection } from './Collection'-export type { default as CustomField } from './CustomField'export type { default as FulfillmentItem } from './FulfillmentItem'export type { default as Fulfillment } from './Fulfillment'export type { default as Invitation } from './Invitation'@@ -16,8 +15,6 @@ export type { default as Media } from './Media'export type { default as OrderLineItem } from './OrderLineItem'export type { default as Order } from './Order'export type { default as Product } from './Product'-export type { default as ProductTypeCustomFieldDefinition } from './ProductTypeCustomFieldDefinition'-export type { default as ProductType } from './ProductType'export type { default as Profile } from './Profile'export type { default as RequirementCustomField } from './RequirementCustomField'export type { default as RequirementStatus } from './RequirementStatus'diff --git a/spree/api/app/controllers/spree/api/v3/seller/categories_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/categories_controller.rbdeleted file mode 100644index 90dc7f539d..0000000000--- a/spree/api/app/controllers/spree/api/v3/seller/categories_controller.rb+++ /dev/null@@ -1,30 +0,0 @@-module Spree- module Api- module V3- module Seller- # The categories a seller may file a product under.- #- # Read only: a seller chooses from what the marketplace offers, they do- # not extend it (docs/plans/6.0-seller-product-submission.md). Scoped to- # the store, which is derived from the seller.- class CategoriesController < Seller::ResourceController- scoped_resource :products-- protected-- def model_class- Spree::Category- end-- def serializer_class- Spree.api.seller_category_serializer- end-- def scope- current_store.categories- end- end- end- end- end-enddiff --git a/spree/api/app/controllers/spree/api/v3/seller/collections_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/collections_controller.rbdeleted file mode 100644index 3dff38510c..0000000000--- a/spree/api/app/controllers/spree/api/v3/seller/collections_controller.rb+++ /dev/null@@ -1,30 +0,0 @@-module Spree- module Api- module V3- module Seller- # The collections a seller may file a product under.- #- # Read only: a seller chooses from what the marketplace offers, they do- # not extend it (docs/plans/6.0-seller-product-submission.md). Scoped to- # the store, which is derived from the seller.- class CollectionsController < Seller::ResourceController- scoped_resource :products-- protected-- def model_class- Spree::Collection- end-- def serializer_class- Spree.api.seller_collection_serializer- end-- def scope- current_store.collections- end- end- end- end- end-enddiff --git a/spree/api/app/controllers/spree/api/v3/seller/product_types_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/product_types_controller.rbdeleted file mode 100644index 65e3474b4f..0000000000--- a/spree/api/app/controllers/spree/api/v3/seller/product_types_controller.rb+++ /dev/null@@ -1,35 +0,0 @@-module Spree- module Api- module V3- module Seller- # The product types a seller may list against.- #- # Read only, and deliberately so: a type carries the custom fields a- # seller fills in, so they have to see it, but what types the- # marketplace offers is the operator's decision- # (docs/plans/6.0-seller-product-submission.md).- #- # Types belong to the store rather than to a seller, so this is one of- # the few seller collections not rooted in `current_seller` — the- # store comes from the seller, which is what keeps it scoped.- class ProductTypesController < Seller::ResourceController- scoped_resource :product_types-- protected-- def model_class- Spree::ProductType- end-- def serializer_class- Spree.api.seller_product_type_serializer- end-- def scope- current_store.product_types- end- end- end- end- end-enddiff --git a/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb b/spree/api/app/controllers/spree/api/v3/seller/products_controller.rbindex 3cb2df5900..c6a527888c 100644--- a/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb+++ b/spree/api/app/controllers/spree/api/v3/seller/products_controller.rb@@ -15,9 +15,17 @@ module Spree# master-catalog product are a separate surface (the shared catalog# phase) and do not belong to this seller through `products`.#- # What a seller may change is narrower than the operator's set:- # `tax_category_id` and `delivery_profile_id` are marketplace- # configuration and stay with the operator, as does `promotionable`.+ # What a seller may change is narrower than the operator's set. Tax+ # category, delivery profile and `promotionable` are marketplace+ # configuration, and so is how a product is filed: its type,+ # categories, collections and tags are the marketplace's own+ # merchandising, set when the operator reviews the listing.+ #+ # Tags are the clearest case — they are tenanted to the store+ # (`acts_as_taggable_tenant :store_id`), so a seller typing one would+ # be writing into the marketplace's shared vocabulary rather than+ # labelling their product+ # (docs/plans/6.0-multi-vendor-marketplace.md).class ProductsController < Seller::ResourceControllerscoped_resource :products@@ -75,22 +83,8 @@ module Spreeattrs = params.permit(:name, :description, :slug,:meta_title, :meta_description, :meta_keywords,- :product_type_id,- # Filing a product into the marketplace's existing groupings is- # part of maintaining the product, which is why the operator's- # endpoint permits these under `write_products` too. Creating a- # category or collection remains the operator's.- #- # `tags` is deliberately absent: they are the store's own- # vocabulary (`acts_as_taggable_tenant :store_id`), so a seller- # typing a new one writes into the marketplace's namespace rather- # than onto their product- # (docs/plans/6.0-multi-vendor-marketplace.md).- category_ids: [],- collection_ids: [],metadata: {},prices: [:amount, :compare_at_amount, :currency],- custom_fields: [:id, :custom_field_definition_id, :value, { value: [] }, { value: {} }],# Inline media, the same shape the operator sends. `external_url`# stays out for the same reason it does there — it would make the# server fetch a URL the caller chose.diff --git a/spree/api/app/serializers/spree/api/v3/seller/category_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/category_serializer.rbdeleted file mode 100644index 617dc644d5..0000000000--- a/spree/api/app/serializers/spree/api/v3/seller/category_serializer.rb+++ /dev/null@@ -1,12 +0,0 @@-module Spree- module Api- module V3- module Seller- # A category a seller may file a product under. Read only — the- # marketplace owns its taxonomy.- class CategorySerializer < V3::CategorySerializer- end- end- end- end-enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/collection_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/collection_serializer.rbdeleted file mode 100644index 3325daadd7..0000000000--- a/spree/api/app/serializers/spree/api/v3/seller/collection_serializer.rb+++ /dev/null@@ -1,12 +0,0 @@-module Spree- module Api- module V3- module Seller- # A collection a seller's product can belong to. Read only — creating- # or configuring one is the operator's.- class CollectionSerializer < V3::CollectionSerializer- end- end- end- end-enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/custom_field_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/custom_field_serializer.rbdeleted file mode 100644index 50f945f526..0000000000--- a/spree/api/app/serializers/spree/api/v3/seller/custom_field_serializer.rb+++ /dev/null@@ -1,16 +0,0 @@-module Spree- module Api- module V3- module Seller- # One custom field value a seller filled in.- class CustomFieldSerializer < V3::CustomFieldSerializer- typelize custom_field_definition_id: [:string, nullable: true]-- attribute :custom_field_definition_id do |custom_field|- custom_field.custom_field_definition&.prefixed_id- end- end- end- end- end-enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rbindex 20f216a3ac..e726407717 100644--- a/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/product_serializer.rb@@ -6,35 +6,15 @@ module Spree## Read and write have to name the same fields: the panel loads a# product into a form and sends it back, so anything the controller- # accepts but this withholds would be blanked on save.- #- # `category_ids` is a flat list rather than the operator's expandable- # association — the form binds ids, and a seller has no use for the- # rest of a category.+ # accepts but this withholds would be blanked on save. The reverse+ # matters too — how a product is filed (type, categories, collections,+ # tags) is the marketplace's own merchandising, so it is neither+ # written nor read here.class ProductSerializer < V3::ProductSerializer- typelize status: :string,- product_type_id: [:string, nullable: true],- category_ids: [:string, multi: true],- collection_ids: [:string, multi: true],- metadata: 'Record<string, unknown>'+ typelize status: :string, metadata: 'Record<string, unknown>'attributes :status, :metadata, created_at: :iso8601, updated_at: :iso8601- attribute :product_type_id do |product|- product.product_type&.prefixed_id- end-- attribute :category_ids do |product|- store_id = current_store&.id- product.categories.filter_map do |category|- category.prefixed_id if store_id.nil? || category.store_id == store_id- end- end-- attribute :collection_ids do |product|- product.collections.map(&:prefixed_id)- end-many :variants,resource: proc { Spree.api.seller_variant_serializer },if: proc { expand?('variants') }@@ -51,10 +31,6 @@ module Spreemany :option_types,resource: proc { Spree.api.option_type_serializer },if: proc { expand?('option_types') }-- many :custom_fields,- resource: proc { Spree.api.seller_custom_field_serializer },- if: proc { expand?('custom_fields') }endendenddiff --git a/spree/api/app/serializers/spree/api/v3/seller/product_type_custom_field_definition_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/product_type_custom_field_definition_serializer.rbdeleted file mode 100644index fa4caedf8a..0000000000--- a/spree/api/app/serializers/spree/api/v3/seller/product_type_custom_field_definition_serializer.rb+++ /dev/null@@ -1,45 +0,0 @@-module Spree- module Api- module V3- module Seller- # The schema of one custom field a product type asks for.- #- # Declared rather than subclassed from the admin serializer, like every- # serializer on this branch: what a seller needs is the shape of the- # field they are filling in, and inheriting would tie this branch's- # generated types to the operator's.- class ProductTypeCustomFieldDefinitionSerializer < V3::BaseSerializer- typelize id: :string,- key: :string,- namespace: :string,- label: :string,- field_type: Spree::CustomField::FIELD_TYPE_TOKENS,- required: :boolean,- sort_order: :number-- attribute :id do |join|- join.custom_field_definition.prefixed_id- end-- attribute :key do |join|- join.custom_field_definition.key- end-- attribute :namespace do |join|- join.custom_field_definition.namespace- end-- attribute :label do |join|- join.custom_field_definition.label- end-- attribute :field_type do |join|- join.custom_field_definition.field_type- end-- attributes :required, :sort_order- end- end- end- end-enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/product_type_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/product_type_serializer.rbdeleted file mode 100644index ee98829145..0000000000--- a/spree/api/app/serializers/spree/api/v3/seller/product_type_serializer.rb+++ /dev/null@@ -1,19 +0,0 @@-module Spree- module Api- module V3- module Seller- # A product type as a seller sees it: its name and the custom fields it- # asks them to fill in.- #- # No `products_count` and no option-type or category template — those- # describe how the operator maintains the type, which is not a seller's- # concern.- class ProductTypeSerializer < V3::ProductTypeSerializer- many :product_type_custom_field_definitions,- key: :custom_field_definitions,- resource: proc { Spree.api.seller_product_type_custom_field_definition_serializer }- end- end- end- end-enddiff --git a/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb b/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rbindex 6e15e60491..73099d4e7e 100644--- a/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb+++ b/spree/api/app/serializers/spree/api/v3/seller/variant_serializer.rb@@ -55,10 +55,6 @@ module Spreeresource: proc { Spree.api.price_serializer },if: proc { expand?('prices') }- many :custom_fields,- resource: proc { Spree.api.seller_custom_field_serializer },- if: proc { expand?('custom_fields') }-many :stock_levels,resource: proc { Spree.api.seller_stock_level_serializer },if: proc { expand?('stock_levels') }diff --git a/spree/api/config/initializers/typelizer.rb b/spree/api/config/initializers/typelizer.rbindex 8b831823c3..fe2a2a5d7d 100644--- a/spree/api/config/initializers/typelizer.rb+++ b/spree/api/config/initializers/typelizer.rb@@ -71,10 +71,12 @@ Rails.application.config.after_initialize do## A name the seller branch declares itself must NOT be listed here: both# map to the same bare type name, so listing it emits the export twice and- # the package stops compiling. Category, Media, Variant and CustomField- # left this set when the seller branch grew its own.+ # the package stops compiling. Media and Variant are declared on the seller+ # branch; Category and CustomField are not, but the store product+ # serializer this branch inherits references them, so their types still+ # have to exist in the package.store_nested_for_seller = %w[- Address OptionType OptionValue Price PriceHistory Seller+ Address Category CustomField OptionType OptionValue Price PriceHistory Seller].to_setconfig.writer(:seller) do |c|diff --git a/spree/api/config/routes.rb b/spree/api/config/routes.rbindex 15242ebea2..841aeaf7a6 100644--- a/spree/api/config/routes.rb+++ b/spree/api/config/routes.rb@@ -742,14 +742,6 @@ Spree::Core::Engine.add_routes doendend- # The types a seller may pick from and the fields they fill in. Read- # only — defining either is the operator's.- resources :product_types, only: [:index, :show]-- # What a seller may file a product under. Read only for the same- # reason: the marketplace owns its own taxonomy and merchandising.- resources :categories, only: [:index]- resources :collections, only: [:index]# What this seller has sold. Cancelling is a member action because it# is a workflow with its own arguments, and fulfilling is nested: adiff --git a/spree/api/lib/spree/api/dependencies.rb b/spree/api/lib/spree/api/dependencies.rbindex eb9171ef3d..a2ad0f128f 100644--- a/spree/api/lib/spree/api/dependencies.rb+++ b/spree/api/lib/spree/api/dependencies.rb@@ -165,14 +165,9 @@ module Spreeseller_team_member_serializer: 'Spree::Api::V3::Seller::TeamMemberSerializer',seller_invitation_serializer: 'Spree::Api::V3::Seller::InvitationSerializer',seller_product_serializer: 'Spree::Api::V3::Seller::ProductSerializer',- seller_product_type_serializer: 'Spree::Api::V3::Seller::ProductTypeSerializer',seller_variant_serializer: 'Spree::Api::V3::Seller::VariantSerializer',seller_media_serializer: 'Spree::Api::V3::Seller::MediaSerializer',- seller_custom_field_serializer: 'Spree::Api::V3::Seller::CustomFieldSerializer',- seller_category_serializer: 'Spree::Api::V3::Seller::CategorySerializer',- seller_collection_serializer: 'Spree::Api::V3::Seller::CollectionSerializer',seller_stock_level_serializer: 'Spree::Api::V3::Seller::StockLevelSerializer',- seller_product_type_custom_field_definition_serializer: 'Spree::Api::V3::Seller::ProductTypeCustomFieldDefinitionSerializer',seller_order_serializer: 'Spree::Api::V3::Seller::OrderSerializer',seller_order_line_item_serializer: 'Spree::Api::V3::Seller::OrderLineItemSerializer',seller_fulfillment_serializer: 'Spree::Api::V3::Seller::FulfillmentSerializer',diff --git a/spree/api/spec/controllers/spree/api/v3/seller/categories_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/categories_controller_spec.rbdeleted file mode 100644index c50b48f34f..0000000000--- a/spree/api/spec/controllers/spree/api/v3/seller/categories_controller_spec.rb+++ /dev/null@@ -1,46 +0,0 @@-require 'spec_helper'--# What a seller may file a product under. Read only by design: the marketplace-# owns its taxonomy (docs/plans/6.0-seller-product-submission.md).-RSpec.describe Spree::Api::V3::Seller::CategoriesController, type: :controller do- render_views-- include_context 'API v3 Seller'-- let(:seller_user) do- create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user) }- end- let(:token) do- Spree::Api::V3::TestingSupport.generate_jwt(- seller_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER- )- end-- let!(:category) { create(:category, store: store, name: 'Lighting') }-- before do- request.headers['Authorization'] = "Bearer #{token}"- request.headers['X-Spree-Seller-Id'] = seller.prefixed_id- end-- it "lists the store's categories" do- get :index, as: :json-- expect(response).to have_http_status(:ok)- expect(json_response['data'].pluck('name')).to include('Lighting')- end-- it "leaves out another store's categories" do- elsewhere = create(:category, store: create(:store), name: 'Elsewhere')-- get :index, as: :json-- expect(json_response['data'].pluck('id')).not_to include(elsewhere.prefixed_id)- end-- it 'offers no way to create, edit or delete one' do- expect(post: '/api/v3/seller/categories').not_to be_routable- expect(patch: '/api/v3/seller/categories/cat_x').not_to be_routable- expect(delete: '/api/v3/seller/categories/cat_x').not_to be_routable- end-enddiff --git a/spree/api/spec/controllers/spree/api/v3/seller/collections_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/collections_controller_spec.rbdeleted file mode 100644index 2ff60469c4..0000000000--- a/spree/api/spec/controllers/spree/api/v3/seller/collections_controller_spec.rb+++ /dev/null@@ -1,46 +0,0 @@-require 'spec_helper'--# What a seller may file a product under. Read only by design: the marketplace-# owns its taxonomy (docs/plans/6.0-seller-product-submission.md).-RSpec.describe Spree::Api::V3::Seller::CollectionsController, type: :controller do- render_views-- include_context 'API v3 Seller'-- let(:seller_user) do- create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user) }- end- let(:token) do- Spree::Api::V3::TestingSupport.generate_jwt(- seller_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER- )- end-- let!(:collection) { create(:collection, store: store, name: 'Summer Picks') }-- before do- request.headers['Authorization'] = "Bearer #{token}"- request.headers['X-Spree-Seller-Id'] = seller.prefixed_id- end-- it "lists the store's collections" do- get :index, as: :json-- expect(response).to have_http_status(:ok)- expect(json_response['data'].pluck('name')).to include('Summer Picks')- end-- it "leaves out another store's collections" do- elsewhere = create(:collection, store: create(:store), name: 'Elsewhere')-- get :index, as: :json-- expect(json_response['data'].pluck('id')).not_to include(elsewhere.prefixed_id)- end-- it 'offers no way to create, edit or delete one' do- expect(post: '/api/v3/seller/collections').not_to be_routable- expect(patch: '/api/v3/seller/collections/col_x').not_to be_routable- expect(delete: '/api/v3/seller/collections/col_x').not_to be_routable- end-enddiff --git a/spree/api/spec/controllers/spree/api/v3/seller/product_types_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/product_types_controller_spec.rbdeleted file mode 100644index 41db872500..0000000000--- a/spree/api/spec/controllers/spree/api/v3/seller/product_types_controller_spec.rb+++ /dev/null@@ -1,62 +0,0 @@-require 'spec_helper'--RSpec.describe Spree::Api::V3::Seller::ProductTypesController, type: :controller do- render_views-- include_context 'API v3 Seller'-- let(:seller_user) do- create(:admin_user, :without_admin_role).tap { |user| seller.add_user(user, seller_role) }- end- let(:seller_role) do- create(:role, name: 'Seller', resource: seller, permissions: %w[write_products read_product_types])- end- let(:token) do- Spree::Api::V3::TestingSupport.generate_jwt(- seller_user, audience: Spree::Api::V3::JwtAuthentication::JWT_AUDIENCE_SELLER- )- end-- let!(:product_type) { create(:product_type, store: store, name: 'Apparel') }-- before do- request.headers['Authorization'] = "Bearer #{token}"- request.headers['X-Spree-Seller-Id'] = seller.prefixed_id- end-- describe 'GET #index' do- it "lists the store's types so a seller can pick one" do- get :index, as: :json-- expect(response).to have_http_status(:ok)- expect(json_response['data'].pluck('name')).to include('Apparel')- end-- it "leaves out another store's types" do- elsewhere = create(:product_type, store: create(:store), name: 'Elsewhere')-- get :index, as: :json-- expect(json_response['data'].pluck('id')).not_to include(elsewhere.prefixed_id)- end- end-- describe 'GET #show' do- it 'carries the custom fields the seller has to fill in' do- get :show, params: { id: product_type.prefixed_id }, as: :json-- expect(response).to have_http_status(:ok)- expect(json_response).to have_key('custom_field_definitions')- end- end-- # Defining types is the operator's. A seller sees them to pick one; there is- # no route here to create, edit or delete one.- describe 'writing a type' do- it 'is not routable' do- expect(post: '/api/v3/seller/product_types').not_to be_routable- expect(patch: '/api/v3/seller/product_types/pt_x').not_to be_routable- expect(delete: '/api/v3/seller/product_types/pt_x').not_to be_routable- end- end-enddiff --git a/spree/api/spec/controllers/spree/api/v3/seller/products_controller_spec.rb b/spree/api/spec/controllers/spree/api/v3/seller/products_controller_spec.rbindex 45e85c5ce1..c74f5bcd12 100644--- a/spree/api/spec/controllers/spree/api/v3/seller/products_controller_spec.rb+++ b/spree/api/spec/controllers/spree/api/v3/seller/products_controller_spec.rb@@ -163,32 +163,37 @@ RSpec.describe Spree::Api::V3::Seller::ProductsController, type: :controller do# The panel loads a product into a form and sends it back, so anything the# controller accepts must come back out — otherwise a save blanks it.it 'returns every field it accepts on write' do- category = create(:category, store: store)- product_type = create(:product_type, store: store)- mine.update!(product_type: product_type, categories: [category], metadata: { 'care' => 'wash cold' })+ mine.update!(metadata: { 'care' => 'wash cold' })get :show, params: { id: mine.prefixed_id }, as: :jsonexpect(json_response).to include('name', 'description', 'slug',- 'meta_title', 'meta_description', 'meta_keywords',- 'product_type_id', 'category_ids', 'metadata'+ 'meta_title', 'meta_description', 'meta_keywords', 'metadata')- expect(json_response['product_type_id']).to eq(product_type.prefixed_id)- expect(json_response['category_ids']).to eq([category.prefixed_id])expect(json_response['metadata']).to eq('care' => 'wash cold')end+ # How a product is filed is the marketplace's own merchandising, so the+ # seller serializer adds none of it — a field a seller cannot change should+ # not be shown as though they could. (`tags` rides in from the storefront+ # serializer, where it is public product data; it is simply not writable.)+ it 'withholds the marketplace merchandising fields' do+ get :show, params: { id: mine.prefixed_id }, as: :json++ expect(json_response).not_to include('product_type_id', 'category_ids', 'collection_ids')+ end+# The form loads a product with everything it edits in one request, so each# of these has to resolve — a missing seller-side serializer raises rather# than quietly omitting the key.it 'expands the collections the form edits' doget :show,- params: { id: mine.prefixed_id, expand: 'variants,media,custom_fields,default_variant' },+ params: { id: mine.prefixed_id, expand: 'variants,media,default_variant' },as: :jsonexpect(response).to have_http_status(:ok)- expect(json_response).to include('variants', 'media', 'custom_fields', 'default_variant', 'collection_ids')+ expect(json_response).to include('variants', 'media', 'default_variant')enddescribe 'writing variants, media and memberships' do@@ -231,11 +236,20 @@ RSpec.describe Spree::Api::V3::Seller::ProductsController, type: :controller doexpect(mine.reload.tag_list).to be_emptyend- it 'files the product under a category' do+ it 'cannot file the product under a category' dopatch :update, params: { id: mine.prefixed_id, category_ids: [category.prefixed_id] }, as: :jsonexpect(response).to have_http_status(:ok)- expect(mine.reload.categories).to include(category)+ expect(mine.reload.categories).to be_empty+ end++ it 'cannot set a product type' do+ product_type = create(:product_type, store: store)++ patch :update, params: { id: mine.prefixed_id, product_type_id: product_type.prefixed_id }, as: :json++ expect(response).to have_http_status(:ok)+ expect(mine.reload.product_type).to be_nilend# Marketplace configuration, not a seller's: silently ignored rather than