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
Generate TypeScript types from API serializers
Damian Legawiec51ab19cfac26
diff --git a/CLAUDE.md b/CLAUDE.mdindex 26546acee7..62ff70b5ac 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -94,7 +94,7 @@ For uniqueness validation, always use `scope: spree_base_uniqueness_scope`### Controller Inheritance- Admin controllers inherit from `Spree::Admin::ResourceController` which handles most of CRUD operations-- API controllers inherit from `Spree::Api::V2::BaseController`+- API v3 controllers inherit from `Spree::Api::V3::BaseController`- Storefront controllers inherit from `Spree::StoreController`### Parameter Handling@@ -222,6 +222,58 @@ Navigation options:- `badge` - Lambda returning badge text- `badge_class` - CSS class for badge+## API v3 Development++### Serializers++API v3 uses Alba serializers located in `api/app/serializers/spree/api/v3/`. Following Medusa's pattern, we have separate serializers for Store and Admin APIs:++- **Store serializers** (`app/serializers/spree/api/v3/`) - Customer-facing, limited data+- **Admin serializers** (`app/serializers/spree/api/v3/admin/`) - Full access, extends store serializers++```ruby+# Store serializer - customer-facing+module Spree::Api::V3+ class ProductSerializer < BaseSerializer+ typelize_from Spree::Product+ typelize purchasable: :boolean, in_stock: :boolean, price: 'number | null'++ attributes :id, :name, :description, :slug, :price+ end+end++# Admin serializer - extends store with admin-only fields+module Spree::Api::V3::Admin+ class ProductSerializer < V3::ProductSerializer+ typelize_from Spree::Product+ typelize cost_price: 'number | null', private_metadata: 'Record<string, unknown> | null'++ attributes :status, :cost_price, :private_metadata+ end+end+```++### TypeScript Type Generation++We use [typelizer](https://github.com/skryukov/typelizer) to generate TypeScript types from Alba serializers:++- Types are generated to `sdk/src/types/generated/`+- Store types: `StoreProduct`, `StoreOrder`, etc.+- Admin types: `AdminProduct`, `AdminOrder`, etc.+- Run `bundle exec rake typelizer:generate` to regenerate types++### Serializer DSL++- `typelize_from Model` - Connect serializer to ActiveRecord model for type inference+- `typelize attr: :type` - Define types for computed/delegated attributes+- Use `Spree.api.serializer_name` for configurable serializer references++### API Authentication++API v3 uses API keys with scopes:+- `store` scope - Customer-facing operations (cart, checkout, account)+- `admin` scope - Administrative operations (full CRUD access)+## Events SystemWhen adding new functionality that other parts of the system (or external integrations) might need to react to, fire events using Spree's event system:diff --git a/api/CLAUDE.md b/api/CLAUDE.mdnew file mode 100644index 0000000000..626ad32066--- /dev/null+++ b/api/CLAUDE.md@@ -0,0 +1,235 @@+# Claude Code Rules for Spree API Development++## API v3 Architecture++### Serializers++API v3 uses Alba serializers following Medusa's pattern with separate Store and Admin types:++**Directory Structure:**+- `app/serializers/spree/api/v3/` - Store serializers (customer-facing)+- `app/serializers/spree/api/v3/admin/` - Admin serializers (extends store serializers)++**Creating a Store Serializer:**++```ruby+module Spree+ module Api+ module V3+ class ProductSerializer < BaseSerializer+ typelize_from Spree::Product+ typelize purchasable: :boolean, in_stock: :boolean, price: 'number | null'++ attributes :id, :name, :description, :slug+ attributes available_on: :iso8601, created_at: :iso8601++ attribute :price do |product|+ product.default_variant.price&.to_f+ end++ many :variants,+ resource: Spree.api.variant_serializer,+ if: proc { params[:includes]&.include?('variants') }+ end+ end+ end+end+```++**Creating an Admin Serializer:**++```ruby+module Spree+ module Api+ module V3+ module Admin+ class ProductSerializer < V3::ProductSerializer+ typelize_from Spree::Product+ typelize cost_price: 'number | null',+ private_metadata: 'Record<string, unknown> | null'++ attributes :status, :cost_price, :private_metadata++ # Override to use admin variant serializer+ many :variants,+ resource: Spree::Api::V3::Admin::VariantSerializer,+ if: proc { params[:includes]&.include?('variants') }+ end+ end+ end+ end+end+```++### Typelizer DSL++- `typelize_from Model` - Connect serializer to ActiveRecord model for automatic type inference+- `typelize attr: :type` - Define types for computed/delegated attributes not on the model+- Type formats: `:string`, `:boolean`, `:number`, `'string | null'`, `'string[]'`, `'Record<string, unknown>'`++### TypeScript Type Generation++Types are generated to `sdk/src/types/generated/`:++```bash+# Generate types+bundle exec rake typelizer:generate+```++Naming convention:+- Store serializers -> `Store{Name}` (e.g., `StoreProduct`)+- Admin serializers -> `Admin{Name}` (e.g., `AdminProduct`)++### Controllers++**Store API Controllers:**++```ruby+module Spree+ module Api+ module V3+ class ProductsController < BaseController+ def index+ products = current_store.products.available+ render json: serialize(products)+ end++ def show+ product = current_store.products.find_by!(slug: params[:id])+ render json: serialize(product)+ end++ private++ def serialize(resource, options = {})+ serializer_class.new(resource, serializer_params.merge(options)).serialize+ end++ def serializer_class+ Spree.api.product_serializer.constantize+ end++ def serializer_params+ {+ params: {+ store: current_store,+ currency: current_currency,+ includes: include_params+ }+ }+ end+ end+ end+ end+end+```++**Admin API Controllers:**++```ruby+module Spree+ module Api+ module V3+ module Admin+ class ProductsController < AdminController+ def index+ products = scope.ransack(params[:q]).result+ render json: serialize(products)+ end++ private++ def scope+ Spree::Product.accessible_by(current_ability)+ end++ def serializer_class+ Spree::Api::V3::Admin::ProductSerializer+ end+ end+ end+ end+ end+end+```++### API Key Authentication++API v3 uses `Spree::ApiKey` for authentication:++- **Publishable keys** (`spree_pk_xxx`) - Store API, rate-limited+- **Secret keys** (`spree_sk_xxx`) - Admin API, full access++```ruby+# In controllers+before_action :authenticate_api_key!++def current_api_key+ @current_api_key ||= Spree::ApiKey.find_by(key: bearer_token)+end++def admin_context?+ current_api_key&.admin?+end+```++### Testing++**Request Specs:**++```ruby+RSpec.describe 'Products API', type: :request do+ let(:store) { create(:store) }+ let(:api_key) { create(:api_key, scope: 'store', store: store) }+ let(:headers) { { 'Authorization' => "Bearer #{api_key.key}" } }++ describe 'GET /api/v3/products' do+ it 'returns products' do+ product = create(:product, stores: [store])++ get '/api/v3/products', headers: headers++ expect(response).to have_http_status(:ok)+ expect(json_response['data'].first['id']).to eq(product.id)+ end+ end+end+```++### OpenAPI Specification++API specs are documented using rswag:++```ruby+# spec/integration/api/v3/products_spec.rb+RSpec.describe 'Products API', type: :request do+ path '/api/v3/products' do+ get 'List products' do+ tags 'Products'+ produces 'application/json'++ response '200', 'products found' do+ schema type: :object,+ properties: {+ data: { type: :array, items: { '$ref' => '#/components/schemas/StoreProduct' } }+ }+ run_test!+ end+ end+ end+end+```++Generate OpenAPI spec:++```bash+bundle exec rake rswag:specs:swaggerize+```++## File Locations++- Controllers: `app/controllers/spree/api/v3/`+- Serializers: `app/serializers/spree/api/v3/`+- Request specs: `spec/requests/spree/api/v3/`+- Integration specs (rswag): `spec/integration/spree/api/v3/`+- Generated types: `sdk/src/types/generated/`diff --git a/api/README.md b/api/README.mdindex e2269924d0..d8dd3394e9 100644--- a/api/README.md+++ b/api/README.md@@ -8,55 +8,76 @@ Spree API provides RESTful API endpoints for building custom storefronts, mobileThis gem includes:-- **Storefront API** - Customer-facing endpoints for cart, checkout, products, and accounts-- **Platform API** - Administrative endpoints for managing orders, products, and store settings+- **Store API v3** - Customer-facing endpoints for cart, checkout, products, and accounts+- **Admin API v3** - Administrative endpoints for managing orders, products, and store settings- **Webhooks** - Event-driven notifications to external systems-- **OAuth2 Authentication** - Token-based authentication via Doorkeeper-- **JSONAPI Serializers** - Standardized API responses+- **API Key Authentication** - Secure token-based authentication with scopes+- **Alba Serializers** - Fast, flexible JSON serialization with TypeScript type generation## InstallationThis gem is included in every Spree installation. No additional steps are required.-## API Endpoints+## API v3 Endpoints-### Storefront API (v2)+### Store API-The Storefront API is designed for building custom frontends:+The Store API is designed for building custom storefronts:```-GET /api/v2/storefront/products-GET /api/v2/storefront/products/:id-GET /api/v2/storefront/taxons-POST /api/v2/storefront/cart-PATCH /api/v2/storefront/cart/add_item-PATCH /api/v2/storefront/checkout-POST /api/v2/storefront/account+GET /api/v3/products+GET /api/v3/products/:id+GET /api/v3/taxons+GET /api/v3/taxonomies+POST /api/v3/cart+PATCH /api/v3/cart/add_item+PATCH /api/v3/checkout+GET /api/v3/account```-### Platform API+### Admin API-The Platform API provides administrative access:+The Admin API provides full administrative access:```-GET /api/v2/platform/orders-POST /api/v2/platform/products-PATCH /api/v2/platform/variants/:id-DELETE /api/v2/platform/line_items/:id+GET /api/v3/admin/orders+POST /api/v3/admin/products+PATCH /api/v3/admin/variants/:id+DELETE /api/v3/admin/line_items/:id```## Authentication-### OAuth2 Token Authentication+### API Key Authentication++Create API keys with appropriate scopes:++```ruby+# Store API key (customer-facing)+api_key = Spree::ApiKey.create!(+ name: 'My Storefront',+ scope: 'store',+ store: current_store+)++# Admin API key (full access)+admin_key = Spree::ApiKey.create!(+ name: 'Admin Integration',+ scope: 'admin',+ store: current_store+)+```++Use the API key in requests:```bash-# Request access token-curl -X POST https://your-store.com/spree_oauth/token \- -d "grant_type=password&[email protected]&password=secret"+# Store API+curl -H "Authorization: Bearer spree_pk_xxx" \+ https://your-store.com/api/v3/products-# Use token in requests-curl -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \- https://your-store.com/api/v2/storefront/account+# Admin API+curl -H "Authorization: Bearer spree_sk_xxx" \+ https://your-store.com/api/v3/admin/orders```### Guest Cart Token@@ -65,25 +86,43 @@ For guest checkout, use the `X-Spree-Order-Token` header:```bashcurl -H "X-Spree-Order-Token: ORDER_TOKEN" \- https://your-store.com/api/v2/storefront/cart+ https://your-store.com/api/v3/cart```## Serializers-API responses use JSONAPI format. Customize serializers by creating your own:+API v3 uses Alba serializers for fast JSON serialization. Serializers are organized by scope:++- `app/serializers/spree/api/v3/` - Store API serializers+- `app/serializers/spree/api/v3/admin/` - Admin API serializers++Customize serializers by creating your own:```ruby# app/serializers/my_app/product_serializer.rbmodule MyApp- class ProductSerializer < Spree::V2::Storefront::ProductSerializer+ class ProductSerializer < Spree::Api::V3::ProductSerializerattribute :custom_fieldendend# Configure in initializer-Spree.api.storefront_product_serializer = 'MyApp::ProductSerializer'+Spree.api.product_serializer = 'MyApp::ProductSerializer'```+## TypeScript Types++TypeScript types are automatically generated from serializers using [typelizer](https://github.com/skryukov/typelizer):++```bash+# Generate TypeScript types+bundle exec rake typelizer:generate+```++Types are output to `sdk/src/types/generated/` with naming:+- Store types: `StoreProduct`, `StoreOrder`, etc.+- Admin types: `AdminProduct`, `AdminOrder`, etc.+## Testing```bash@@ -94,6 +133,5 @@ bundle exec rspec## Documentation-- [Storefront API Reference](https://docs.spreecommerce.org/api/storefront)-- [Platform API Reference](https://docs.spreecommerce.org/api/platform)+- [API Reference](https://docs.spreecommerce.org/api)- [Authentication Guide](https://docs.spreecommerce.org/developer/api/authentication)\ No newline at end of filediff --git a/api/Rakefile b/api/Rakefileindex f7bfeafbf6..771bfcf5f0 100644--- a/api/Rakefile+++ b/api/Rakefile@@ -27,3 +27,26 @@ namespace :rswag doendendend++namespace :typelizer do+ desc 'Generate TypeScript types from Alba serializers'+ task :generate do+ ENV['RAILS_ENV'] ||= 'test'+ ENV['DISABLE_TYPELIZER'] = 'false'++ require File.expand_path('spec/dummy/config/environment', __dir__)++ # Eager load serializers so typelizer can find them+ serializers_path = File.expand_path('app/serializers/spree/api/v3', __dir__)+ Rails.autoloaders.main.eager_load_dir(serializers_path)++ require 'typelizer/generator'+ serializers = Typelizer::Generator.call(force: true)++ puts "Generated TypeScript types for #{serializers.size} serializers"+ puts "Output: #{Typelizer.configuration.writer_config.output_dir}"+ end++ desc 'Clean and regenerate TypeScript types'+ task refresh: :generate+enddiff --git a/api/app/serializers/spree/api/v3/address_serializer.rb b/api/app/serializers/spree/api/v3/address_serializer.rbnew file mode 100644index 0000000000..831789e71c--- /dev/null+++ b/api/app/serializers/spree/api/v3/address_serializer.rb@@ -0,0 +1,15 @@+module Spree+ module Api+ module V3+ class AddressSerializer < BaseSerializer+ typelize_from Spree::Address+ typelize full_name: :string, state_text: 'string | null',+ country_iso: :string, country_name: :string++ attributes :id, :firstname, :lastname, :full_name, :address1, :address2,+ :city, :zipcode, :phone, :company, :state_id,+ :state_text, :country_id, :country_iso, :country_name+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/admin/order_serializer.rb b/api/app/serializers/spree/api/v3/admin/order_serializer.rbnew file mode 100644index 0000000000..e61f3fab75--- /dev/null+++ b/api/app/serializers/spree/api/v3/admin/order_serializer.rb@@ -0,0 +1,46 @@+module Spree+ module Api+ module V3+ module Admin+ # Admin API Order Serializer+ # Full order data including admin-only fields+ class OrderSerializer < V3::OrderSerializer+ typelize_from Spree::Order++ typelize canceler_id: 'string | null', created_by_id: 'string | null',+ public_metadata: 'Record<string, unknown> | null',+ private_metadata: 'Record<string, unknown> | null',+ canceled_at: 'string | null', approved_at: 'string | null'++ # Admin-only attributes+ attributes :channel, :last_ip_address, :considered_risky,+ :confirmation_delivered, :store_owner_notification_delivered,+ :internal_note, :approver_id,+ canceled_at: :iso8601, approved_at: :iso8601++ attribute :canceler_id do |order|+ order.canceler_id+ end++ attribute :created_by_id do |order|+ order.created_by_id+ end++ attribute :public_metadata do |order|+ order.public_metadata+ end++ attribute :private_metadata do |order|+ order.private_metadata+ end++ one :user,+ resource: Spree::Api::V3::Admin::UserSerializer,+ if: proc { params[:includes]&.include?('user') }++ # TODO: Add adjustments associations when Admin API is implemented+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/admin/product_serializer.rb b/api/app/serializers/spree/api/v3/admin/product_serializer.rbnew file mode 100644index 0000000000..68133da81f--- /dev/null+++ b/api/app/serializers/spree/api/v3/admin/product_serializer.rb@@ -0,0 +1,53 @@+module Spree+ module Api+ module V3+ module Admin+ # Admin API Product Serializer+ # Full product data including admin-only fields+ # Extends the store serializer with additional attributes+ class ProductSerializer < V3::ProductSerializer+ typelize_from Spree::Product++ # Additional type hints for admin-only computed attributes+ typelize cost_price: 'number | null', cost_currency: 'string | null',+ public_metadata: 'Record<string, unknown> | null',+ private_metadata: 'Record<string, unknown> | null',+ deleted_at: 'string | null'++ # Admin-only attributes+ attributes :status, :make_active_at, :discontinue_on, deleted_at: :iso8601++ attribute :cost_price do |product|+ product.master&.cost_price&.to_f+ end++ attribute :cost_currency do |product|+ product.master&.cost_currency+ end++ attribute :public_metadata do |product|+ product.public_metadata+ end++ attribute :private_metadata do |product|+ product.private_metadata+ end++ # Admin uses admin variant serializer+ many :variants,+ resource: Spree::Api::V3::Admin::VariantSerializer,+ if: proc { params[:includes]&.include?('variants') }++ one :default_variant,+ resource: Spree::Api::V3::Admin::VariantSerializer,+ if: proc { params[:includes]&.include?('default_variant') }++ one :master,+ key: :master_variant,+ resource: Spree::Api::V3::Admin::VariantSerializer,+ if: proc { params[:includes]&.include?('master_variant') }+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/admin/user_serializer.rb b/api/app/serializers/spree/api/v3/admin/user_serializer.rbnew file mode 100644index 0000000000..464c45f14c--- /dev/null+++ b/api/app/serializers/spree/api/v3/admin/user_serializer.rb@@ -0,0 +1,47 @@+module Spree+ module Api+ module V3+ module Admin+ # Admin API User Serializer+ # Full user data including admin-only fields+ class UserSerializer < V3::UserSerializer+ # Note: Using Spree.user_class dynamically, typelize_from not applicable here++ # Admin-only attributes+ attributes :phone, :login, :accepts_email_marketing,+ last_sign_in_at: :iso8601, current_sign_in_at: :iso8601++ attribute :sign_in_count do |user|+ user.sign_in_count+ end++ attribute :failed_attempts do |user|+ user.failed_attempts+ end++ attribute :last_sign_in_ip do |user|+ user.last_sign_in_ip+ end++ attribute :current_sign_in_ip do |user|+ user.current_sign_in_ip+ end++ attribute :public_metadata do |user|+ user.public_metadata+ end++ attribute :private_metadata do |user|+ user.private_metadata+ end++ many :orders,+ resource: Spree::Api::V3::Admin::OrderSerializer,+ if: proc { params[:includes]&.include?('orders') }++ # TODO: Add store_credits association when Admin API is implemented+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/admin/variant_serializer.rb b/api/app/serializers/spree/api/v3/admin/variant_serializer.rbnew file mode 100644index 0000000000..88371795d5--- /dev/null+++ b/api/app/serializers/spree/api/v3/admin/variant_serializer.rb@@ -0,0 +1,45 @@+module Spree+ module Api+ module V3+ module Admin+ # Admin API Variant Serializer+ # Full variant data including admin-only fields+ class VariantSerializer < V3::VariantSerializer+ typelize_from Spree::Variant++ # Additional type hints for admin-only attributes+ typelize cost_price: 'number | null', cost_currency: 'string | null',+ total_on_hand: 'number | null',+ public_metadata: 'Record<string, unknown> | null',+ private_metadata: 'Record<string, unknown> | null',+ deleted_at: 'string | null'++ # Admin-only attributes+ attributes :position, :tax_category_id, deleted_at: :iso8601++ attribute :cost_price do |variant|+ variant.cost_price&.to_f+ end++ attribute :cost_currency do |variant|+ variant.cost_currency+ end++ attribute :total_on_hand do |variant|+ variant.total_on_hand+ end++ attribute :public_metadata do |variant|+ variant.public_metadata+ end++ attribute :private_metadata do |variant|+ variant.private_metadata+ end++ # TODO: Add stock_items and prices associations when Admin API is implemented+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/base_serializer.rb b/api/app/serializers/spree/api/v3/base_serializer.rbindex fad6026bd9..d50c1b2a32 100644--- a/api/app/serializers/spree/api/v3/base_serializer.rb+++ b/api/app/serializers/spree/api/v3/base_serializer.rb@@ -3,6 +3,7 @@ module Spreemodule V3class BaseSerializerinclude Alba::Resource+ include Typelizer::DSL# Context accessorsdef current_storediff --git a/api/app/serializers/spree/api/v3/country_serializer.rb b/api/app/serializers/spree/api/v3/country_serializer.rbnew file mode 100644index 0000000000..43303cbf07--- /dev/null+++ b/api/app/serializers/spree/api/v3/country_serializer.rb@@ -0,0 +1,15 @@+module Spree+ module Api+ module V3+ class CountrySerializer < BaseSerializer+ typelize_from Spree::Country++ attributes :id, :iso, :iso3, :iso_name, :name, :states_required, :zipcode_required++ many :states,+ resource: Spree.api.state_serializer,+ if: proc { params[:includes]&.include?('states') }+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/digital_link_serializer.rb b/api/app/serializers/spree/api/v3/digital_link_serializer.rbnew file mode 100644index 0000000000..24036d33e6--- /dev/null+++ b/api/app/serializers/spree/api/v3/digital_link_serializer.rb@@ -0,0 +1,26 @@+module Spree+ module Api+ module V3+ class DigitalLinkSerializer < BaseSerializer+ typelize_from Spree::DigitalLink+ typelize authorizable: :boolean, expired: :boolean, access_limit_exceeded: :boolean,+ filename: :string, content_type: :string++ attributes :id, :access_counter, :filename, :content_type,+ created_at: :iso8601, updated_at: :iso8601++ attribute :authorizable do |digital_link|+ digital_link.authorizable?+ end++ attribute :expired do |digital_link|+ digital_link.expired?+ end++ attribute :access_limit_exceeded do |digital_link|+ digital_link.access_limit_exceeded?+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/image_serializer.rb b/api/app/serializers/spree/api/v3/image_serializer.rbnew file mode 100644index 0000000000..7ea948cd4c--- /dev/null+++ b/api/app/serializers/spree/api/v3/image_serializer.rb@@ -0,0 +1,44 @@+module Spree+ module Api+ module V3+ class ImageSerializer < BaseSerializer+ typelize_from Spree::Image+ typelize original_url: 'string | null', mini_url: 'string | null',+ small_url: 'string | null', medium_url: 'string | null',+ large_url: 'string | null', xlarge_url: 'string | null'++ attributes :id, :position, :alt, :viewable_type, :viewable_id,+ created_at: :iso8601, updated_at: :iso8601++ attribute :original_url do |image|+ image_url(image)+ end++ # Dynamically define attributes for each configured image variant+ # Uses named variants from Spree::Config.product_image_variant_sizes+ # (e.g., mini, small, medium, large, xlarge)+ Spree::Config.product_image_variant_sizes.each_key do |variant_name|+ attribute :"#{variant_name}_url" do |image|+ variant_url(image, variant_name)+ end+ end++ private++ def image_url(image)+ return nil unless image&.attachment&.attached?++ Rails.application.routes.url_helpers.cdn_image_url(image.attachment)+ end++ def variant_url(image, variant_name)+ return nil unless image&.attachment&.attached?++ Rails.application.routes.url_helpers.cdn_image_url(+ image.attachment.variant(variant_name)+ )+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/line_item_serializer.rb b/api/app/serializers/spree/api/v3/line_item_serializer.rbnew file mode 100644index 0000000000..c96b6e1bf5--- /dev/null+++ b/api/app/serializers/spree/api/v3/line_item_serializer.rb@@ -0,0 +1,29 @@+module Spree+ module Api+ module V3+ class LineItemSerializer < BaseSerializer+ typelize_from Spree::LineItem+ typelize name: :string, slug: :string, options_text: :string,+ display_price: :string, display_total: :string,+ display_adjustment_total: :string, display_additional_tax_total: :string,+ display_included_tax_total: :string, display_promo_total: :string,+ display_pre_tax_amount: :string, display_discounted_amount: :string,+ display_compare_at_amount: 'string | null'++ attributes :id, :variant_id, :quantity, :name, :slug, :options_text,+ :price, :display_price, :total, :display_total,+ :adjustment_total, :display_adjustment_total,+ :additional_tax_total, :display_additional_tax_total,+ :included_tax_total, :display_included_tax_total,+ :promo_total, :display_promo_total,+ :pre_tax_amount, :display_pre_tax_amount,+ :discounted_amount, :display_discounted_amount,+ :compare_at_amount, :display_compare_at_amount,+ created_at: :iso8601, updated_at: :iso8601++ many :images, resource: Spree.api.image_serializer+ many :option_values, resource: Spree.api.option_value_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/option_type_serializer.rb b/api/app/serializers/spree/api/v3/option_type_serializer.rbnew file mode 100644index 0000000000..13fd9c11ec--- /dev/null+++ b/api/app/serializers/spree/api/v3/option_type_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class OptionTypeSerializer < BaseSerializer+ typelize_from Spree::OptionType++ attributes :id, :name, :presentation, :position+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/option_value_serializer.rb b/api/app/serializers/spree/api/v3/option_value_serializer.rbnew file mode 100644index 0000000000..7d6caee3aa--- /dev/null+++ b/api/app/serializers/spree/api/v3/option_value_serializer.rb@@ -0,0 +1,20 @@+module Spree+ module Api+ module V3+ class OptionValueSerializer < BaseSerializer+ typelize_from Spree::OptionValue+ typelize option_type_name: :string, option_type_presentation: :string++ attributes :id, :name, :presentation, :position, :option_type_id++ attribute :option_type_name do |option_value|+ option_value.option_type.name+ end++ attribute :option_type_presentation do |option_value|+ option_value.option_type.presentation+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/order_promotion_serializer.rb b/api/app/serializers/spree/api/v3/order_promotion_serializer.rbnew file mode 100644index 0000000000..aebafd58a9--- /dev/null+++ b/api/app/serializers/spree/api/v3/order_promotion_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class OrderPromotionSerializer < BaseSerializer+ typelize_from Spree::OrderPromotion++ attributes :id, :name, :description, :code, :amount, :display_amount, :promotion_id+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/order_serializer.rb b/api/app/serializers/spree/api/v3/order_serializer.rbnew file mode 100644index 0000000000..38efa003d6--- /dev/null+++ b/api/app/serializers/spree/api/v3/order_serializer.rb@@ -0,0 +1,46 @@+module Spree+ module Api+ module V3+ # Store API Order Serializer+ # Customer-facing order data+ class OrderSerializer < BaseSerializer+ typelize_from Spree::Order++ attributes :id, :number, :state, :token, :email, :special_instructions,+ :currency, :item_count, :shipment_state, :payment_state,+ :item_total, :display_item_total, :ship_total, :display_ship_total,+ :adjustment_total, :display_adjustment_total, :promo_total, :display_promo_total,+ :tax_total, :display_tax_total, :included_tax_total, :display_included_tax_total,+ :additional_tax_total, :display_additional_tax_total, :total, :display_total,+ completed_at: :iso8601, created_at: :iso8601, updated_at: :iso8601++ many :order_promotions,+ resource: Spree.api.order_promotion_serializer,+ if: proc { params[:includes]&.include?('order_promotions') }++ many :line_items,+ resource: Spree.api.line_item_serializer,+ if: proc { params[:includes]&.include?('line_items') }++ many :shipments,+ resource: Spree.api.shipment_serializer,+ if: proc { params[:includes]&.include?('shipments') }++ many :payments,+ resource: Spree.api.payment_serializer,+ if: proc { params[:includes]&.include?('payments') }++ one :bill_address,+ resource: Spree.api.address_serializer,+ if: proc { params[:includes]&.include?('bill_address') }++ one :ship_address,+ resource: Spree.api.address_serializer,+ if: proc { params[:includes]&.include?('ship_address') }++ many :payment_methods,+ resource: Spree.api.payment_method_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/payment_method_serializer.rb b/api/app/serializers/spree/api/v3/payment_method_serializer.rbnew file mode 100644index 0000000000..4231541c06--- /dev/null+++ b/api/app/serializers/spree/api/v3/payment_method_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class PaymentMethodSerializer < BaseSerializer+ typelize_from Spree::PaymentMethod++ attributes :id, :name, :description, :type+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/payment_serializer.rb b/api/app/serializers/spree/api/v3/payment_serializer.rbnew file mode 100644index 0000000000..ede9160888--- /dev/null+++ b/api/app/serializers/spree/api/v3/payment_serializer.rb@@ -0,0 +1,14 @@+module Spree+ module Api+ module V3+ class PaymentSerializer < BaseSerializer+ typelize_from Spree::Payment++ attributes :id, :state, :payment_method_id, :response_code, :number, :amount, :display_amount,+ created_at: :iso8601, updated_at: :iso8601++ one :payment_method, resource: Spree.api.payment_method_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/product_serializer.rb b/api/app/serializers/spree/api/v3/product_serializer.rbnew file mode 100644index 0000000000..b6b1a159fc--- /dev/null+++ b/api/app/serializers/spree/api/v3/product_serializer.rb@@ -0,0 +1,102 @@+module Spree+ module Api+ module V3+ # Store API Product Serializer+ # Customer-facing product data with limited fields+ class ProductSerializer < BaseSerializer+ typelize_from Spree::Product++ # Type hints for computed/delegated attributes+ typelize sku: 'string | null', barcode: 'string | null',+ purchasable: :boolean, in_stock: :boolean, backorderable: :boolean, available: :boolean,+ price: 'number | null', price_in_cents: 'number | null', display_price: 'string | null',+ compare_at_price: 'number | null', compare_at_price_in_cents: 'number | null',+ display_compare_at_price: 'string | null', tags: 'string[]'++ attributes :id, :name, :description, :slug, :sku, :barcode,+ :meta_description, :meta_keywords,+ available_on: :iso8601, created_at: :iso8601, updated_at: :iso8601++ attribute :purchasable do |product|+ product.purchasable?+ end++ attribute :in_stock do |product|+ product.in_stock?+ end++ attribute :backorderable do |product|+ product.backorderable?+ end++ attribute :available do |product|+ product.available?+ end++ attribute :price do |product|+ price_object(product)&.amount&.to_f+ end++ attribute :price_in_cents do |product|+ price_object(product)&.display_amount&.amount_in_cents+ end++ attribute :display_price do |product|+ price_object(product)&.display_price&.to_s+ end++ attribute :compare_at_price do |product|+ price_object(product)&.compare_at_amount&.to_f+ end++ attribute :compare_at_price_in_cents do |product|+ price_object(product)&.display_compare_at_amount&.amount_in_cents if price_object(product)&.compare_at_amount&.present?+ end++ attribute :display_compare_at_price do |product|+ price_object(product)&.display_compare_at_amount&.to_s if price_object(product)&.compare_at_amount&.present?+ end++ attribute :tags do |product|+ product.taggings.map(&:tag)+ end++ # Conditional associations+ many :variant_images,+ key: :images,+ resource: Spree.api.image_serializer,+ if: proc { params[:includes]&.include?('images') }++ many :variants,+ resource: Spree.api.variant_serializer,+ if: proc { params[:includes]&.include?('variants') }++ one :default_variant,+ resource: Spree.api.variant_serializer,+ if: proc { params[:includes]&.include?('default_variant') }++ one :master,+ key: :master_variant,+ resource: Spree.api.variant_serializer,+ if: proc { params[:includes]&.include?('master_variant') }++ many :option_types,+ resource: Spree.api.option_type_serializer,+ if: proc { params[:includes]&.include?('option_types') }++ many :taxons,+ proc { |taxons, params|+ taxons.select { |t| t.taxonomy.store_id == params[:store].id }+ },+ resource: Spree.api.taxon_serializer,+ if: proc { params[:includes]&.include?('taxons') }++ private++ def price_object(product)+ @price_object ||= price_for(product.default_variant)+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/shipment_serializer.rb b/api/app/serializers/spree/api/v3/shipment_serializer.rbnew file mode 100644index 0000000000..f7cc50304d--- /dev/null+++ b/api/app/serializers/spree/api/v3/shipment_serializer.rb@@ -0,0 +1,19 @@+module Spree+ module Api+ module V3+ class ShipmentSerializer < BaseSerializer+ typelize_from Spree::Shipment++ attributes :id, :number, :state, :tracking, :tracking_url, :shipped_at,+ :cost, :display_cost, :adjustment_total, :display_adjustment_total,+ :additional_tax_total, :display_additional_tax_total, :promo_total, :display_promo_total,+ :included_tax_total, :display_included_tax_total, :total, :display_total,+ created_at: :iso8601, updated_at: :iso8601++ one :shipping_method, resource: Spree.api.shipping_method_serializer+ one :stock_location, resource: Spree.api.stock_location_serializer+ many :shipping_rates, resource: Spree.api.shipping_rate_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/shipping_method_serializer.rb b/api/app/serializers/spree/api/v3/shipping_method_serializer.rbnew file mode 100644index 0000000000..0a22ec26b7--- /dev/null+++ b/api/app/serializers/spree/api/v3/shipping_method_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class ShippingMethodSerializer < BaseSerializer+ typelize_from Spree::ShippingMethod++ attributes :id, :name, :code+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/shipping_rate_serializer.rb b/api/app/serializers/spree/api/v3/shipping_rate_serializer.rbnew file mode 100644index 0000000000..05fa7e8fc7--- /dev/null+++ b/api/app/serializers/spree/api/v3/shipping_rate_serializer.rb@@ -0,0 +1,22 @@+module Spree+ module Api+ module V3+ class ShippingRateSerializer < BaseSerializer+ typelize_from Spree::ShippingRate+ typelize cost: :number, display_cost: :string++ attributes :id, :name, :selected, :shipping_method_id++ attribute :cost do |shipping_rate|+ shipping_rate.cost.to_f+ end++ attribute :display_cost do |shipping_rate|+ shipping_rate.display_cost.to_s+ end++ one :shipping_method, resource: Spree.api.shipping_method_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/state_serializer.rb b/api/app/serializers/spree/api/v3/state_serializer.rbnew file mode 100644index 0000000000..a33563884c--- /dev/null+++ b/api/app/serializers/spree/api/v3/state_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class StateSerializer < BaseSerializer+ typelize_from Spree::State++ attributes :id, :name, :abbr, :country_id+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/stock_location_serializer.rb b/api/app/serializers/spree/api/v3/stock_location_serializer.rbnew file mode 100644index 0000000000..7dedf3d99b--- /dev/null+++ b/api/app/serializers/spree/api/v3/stock_location_serializer.rb@@ -0,0 +1,11 @@+module Spree+ module Api+ module V3+ class StockLocationSerializer < BaseSerializer+ typelize_from Spree::StockLocation++ attributes :id, :name, :address1, :city, :zipcode, :country_id, :country_iso, :country_name, :state_id, :state_text+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/store/address_serializer.rb b/api/app/serializers/spree/api/v3/store/address_serializer.rbdeleted file mode 100644index f1b1a29c73..0000000000--- a/api/app/serializers/spree/api/v3/store/address_serializer.rb+++ /dev/null@@ -1,13 +0,0 @@-module Spree- module Api- module V3- module Store- class AddressSerializer < BaseSerializer- attributes :id, :firstname, :lastname, :full_name, :address1, :address2,- :city, :zipcode, :phone, :company, :state_id,- :state_text, :country_id, :country_iso, :country_name- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/country_serializer.rb b/api/app/serializers/spree/api/v3/store/country_serializer.rbdeleted file mode 100644index 38d3842b34..0000000000--- a/api/app/serializers/spree/api/v3/store/country_serializer.rb+++ /dev/null@@ -1,15 +0,0 @@-module Spree- module Api- module V3- module Store- class CountrySerializer < BaseSerializer- attributes :id, :iso, :iso3, :iso_name, :name, :states_required, :zipcode_required-- many :states,- resource: Spree.api.v3_store_state_serializer,- if: proc { params[:includes]&.include?('states') }- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/digital_link_serializer.rb b/api/app/serializers/spree/api/v3/store/digital_link_serializer.rbdeleted file mode 100644index 2b6029db7e..0000000000--- a/api/app/serializers/spree/api/v3/store/digital_link_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-module Spree- module Api- module V3- module Store- class DigitalLinkSerializer < BaseSerializer- attributes :id, :access_counter, :authorizable, :expired, :access_limit_exceeded,- :filename, :content_type-- attribute :authorizable do |digital_link|- digital_link.authorizable?- end-- attribute :expired do |digital_link|- digital_link.expired?- end-- attribute :access_limit_exceeded do |digital_link|- digital_link.access_limit_exceeded?- end- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/image_serializer.rb b/api/app/serializers/spree/api/v3/store/image_serializer.rbdeleted file mode 100644index 00cc0dbdcd..0000000000--- a/api/app/serializers/spree/api/v3/store/image_serializer.rb+++ /dev/null@@ -1,40 +0,0 @@-module Spree- module Api- module V3- module Store- class ImageSerializer < BaseSerializer- attributes :id, :position, :alt, :viewable_type, :viewable_id-- attribute :original_url do |image|- image_url(image)- end-- # Dynamically define attributes for each configured image variant- # Uses named variants from Spree::Config.product_image_variant_sizes- # (e.g., mini, small, medium, large, xlarge)- Spree::Config.product_image_variant_sizes.each_key do |variant_name|- attribute :"#{variant_name}_url" do |image|- variant_url(image, variant_name)- end- end-- private-- def image_url(image)- return nil unless image&.attachment&.attached?-- Rails.application.routes.url_helpers.cdn_image_url(image.attachment)- end-- def variant_url(image, variant_name)- return nil unless image&.attachment&.attached?-- Rails.application.routes.url_helpers.cdn_image_url(- image.attachment.variant(variant_name)- )- end- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/line_item_serializer.rb b/api/app/serializers/spree/api/v3/store/line_item_serializer.rbdeleted file mode 100644index 93c9cfe548..0000000000--- a/api/app/serializers/spree/api/v3/store/line_item_serializer.rb+++ /dev/null@@ -1,22 +0,0 @@-module Spree- module Api- module V3- module Store- class LineItemSerializer < BaseSerializer- attributes :id, :variant_id, :quantity, :name, :slug, :options_text,- :price, :display_price, :total, :display_total,- :adjustment_total, :display_adjustment_total,- :additional_tax_total, :display_additional_tax_total,- :included_tax_total, :display_included_tax_total,- :promo_total, :display_promo_total,- :pre_tax_amount, :display_pre_tax_amount,- :discounted_amount, :display_discounted_amount,- :compare_at_amount, :display_compare_at_amount-- many :images, resource: Spree.api.v3_store_image_serializer- many :option_values, resource: Spree.api.v3_store_option_value_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/option_type_serializer.rb b/api/app/serializers/spree/api/v3/store/option_type_serializer.rbdeleted file mode 100644index fc54697e5e..0000000000--- a/api/app/serializers/spree/api/v3/store/option_type_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class OptionTypeSerializer < BaseSerializer- attributes :id, :name, :presentation, :position- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/option_value_serializer.rb b/api/app/serializers/spree/api/v3/store/option_value_serializer.rbdeleted file mode 100644index b4c93a4b02..0000000000--- a/api/app/serializers/spree/api/v3/store/option_value_serializer.rb+++ /dev/null@@ -1,19 +0,0 @@-module Spree- module Api- module V3- module Store- class OptionValueSerializer < BaseSerializer- attributes :id, :name, :presentation, :position, :option_type_id-- attribute :option_type_name do |option_value|- option_value.option_type.name- end-- attribute :option_type_presentation do |option_value|- option_value.option_type.presentation- end- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/order_promotion_serializer.rb b/api/app/serializers/spree/api/v3/store/order_promotion_serializer.rbdeleted file mode 100644index 90bed172b1..0000000000--- a/api/app/serializers/spree/api/v3/store/order_promotion_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class OrderPromotionSerializer < BaseSerializer- attributes :id, :name, :description, :code, :amount, :display_amount, :promotion_id- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/order_serializer.rb b/api/app/serializers/spree/api/v3/store/order_serializer.rbdeleted file mode 100644index 30e596cac4..0000000000--- a/api/app/serializers/spree/api/v3/store/order_serializer.rb+++ /dev/null@@ -1,47 +0,0 @@-module Spree- module Api- module V3- module Store- class OrderSerializer < BaseSerializer- attributes :id, :number, :state, :token, :email, :special_instructions,- :currency, :item_count, :shipment_state, :payment_state,- :item_total, :display_item_total, :ship_total, :display_ship_total,- :adjustment_total, :display_adjustment_total, :promo_total, :display_promo_total,- :tax_total, :display_tax_total, :included_tax_total, :display_included_tax_total,- :additional_tax_total, :display_additional_tax_total, :total, :display_total-- # Timestamps- attributes completed_at: :iso8601--- many :order_promotions,- resource: Spree.api.v3_store_order_promotion_serializer,- if: proc { params[:includes]&.include?('order_promotions') }-- many :line_items,- resource: Spree.api.v3_store_line_item_serializer,- if: proc { params[:includes]&.include?('line_items') }-- many :shipments,- resource: Spree.api.v3_store_shipment_serializer,- if: proc { params[:includes]&.include?('shipments') }-- many :payments,- resource: Spree.api.v3_store_payment_serializer,- if: proc { params[:includes]&.include?('payments') }-- one :bill_address,- resource: Spree.api.v3_store_address_serializer,- if: proc { params[:includes]&.include?('bill_address') }-- one :ship_address,- resource: Spree.api.v3_store_address_serializer,- if: proc { params[:includes]&.include?('ship_address') }-- many :payment_methods,- resource: Spree.api.v3_store_payment_method_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/payment_method_serializer.rb b/api/app/serializers/spree/api/v3/store/payment_method_serializer.rbdeleted file mode 100644index 52f9988d6f..0000000000--- a/api/app/serializers/spree/api/v3/store/payment_method_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class PaymentMethodSerializer < BaseSerializer- attributes :id, :name, :description, :type- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/payment_serializer.rb b/api/app/serializers/spree/api/v3/store/payment_serializer.rbdeleted file mode 100644index e497d50387..0000000000--- a/api/app/serializers/spree/api/v3/store/payment_serializer.rb+++ /dev/null@@ -1,13 +0,0 @@-module Spree- module Api- module V3- module Store- class PaymentSerializer < BaseSerializer- attributes :id, :state, :payment_method_id, :response_code, :number, :amount, :display_amount-- one :payment_method, resource: Spree.api.v3_store_payment_method_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/product_serializer.rb b/api/app/serializers/spree/api/v3/store/product_serializer.rbdeleted file mode 100644index cb4e7345f0..0000000000--- a/api/app/serializers/spree/api/v3/store/product_serializer.rb+++ /dev/null@@ -1,93 +0,0 @@-module Spree- module Api- module V3- module Store- class ProductSerializer < BaseSerializer- attributes :id, :name, :description, :slug, :sku, :barcode,- :meta_description, :meta_keywords,- available_on: :iso8601-- attribute :purchasable do |product|- product.purchasable?- end-- attribute :in_stock do |product|- product.in_stock?- end-- attribute :backorderable do |product|- product.backorderable?- end-- attribute :available do |product|- product.available?- end-- attribute :price do |product|- price_object(product)&.amount&.to_f- end-- attribute :price_in_cents do |product|- price_object(product)&.display_amount&.amount_in_cents- end-- attribute :display_price do |product|- price_object(product)&.display_price&.to_s- end-- attribute :compare_at_price do |product|- price_object(product)&.compare_at_amount&.to_f- end-- attribute :compare_at_price_in_cents do |product|- price_object(product)&.display_compare_at_amount&.amount_in_cents if price_object(product)&.compare_at_amount&.present?- end-- attribute :display_compare_at_price do |product|- price_object(product)&.display_compare_at_amount&.to_s if price_object(product)&.compare_at_amount&.present?- end-- attribute :tags do |product|- product.taggings.map(&:tag)- end-- # Conditional associations- many :variant_images,- key: :images,- resource: Spree.api.v3_store_image_serializer,- if: proc { params[:includes]&.include?('images') }-- many :variants,- resource: Spree.api.v3_store_variant_serializer,- if: proc { params[:includes]&.include?('variants') }-- one :default_variant,- resource: Spree.api.v3_store_variant_serializer,- if: proc { params[:includes]&.include?('default_variant') }-- one :master,- key: :master_variant,- resource: Spree.api.v3_store_variant_serializer,- if: proc { params[:includes]&.include?('master_variant') }-- many :option_types,- resource: Spree.api.v3_store_option_type_serializer,- if: proc { params[:includes]&.include?('option_types') }-- many :taxons,- proc { |taxons, params|- taxons.select { |t| t.taxonomy.store_id == params[:store].id}- },- resource: Spree.api.v3_store_taxon_serializer,- if: proc { params[:includes]&.include?('taxons') }-- private-- def price_object(product)- @price_object ||= price_for(product.default_variant)- end- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/shipment_serializer.rb b/api/app/serializers/spree/api/v3/store/shipment_serializer.rbdeleted file mode 100644index adc14f4c19..0000000000--- a/api/app/serializers/spree/api/v3/store/shipment_serializer.rb+++ /dev/null@@ -1,19 +0,0 @@-module Spree- module Api- module V3- module Store- class ShipmentSerializer < BaseSerializer- attributes :id, :number, :state, :tracking, :tracking_url, :shipped_at,- :cost, :display_cost, :adjustment_total, :display_adjustment_total,- :additional_tax_total, :display_additional_tax_total, :promo_total, :display_promo_total,- :included_tax_total, :display_included_tax_total, :total, :display_total-- one :shipping_method, resource: Spree.api.v3_store_shipping_method_serializer- one :stock_location, resource: Spree.api.v3_store_stock_location_serializer-- many :shipping_rates, resource: Spree.api.v3_store_shipping_rate_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/shipping_method_serializer.rb b/api/app/serializers/spree/api/v3/store/shipping_method_serializer.rbdeleted file mode 100644index 43acb42209..0000000000--- a/api/app/serializers/spree/api/v3/store/shipping_method_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class ShippingMethodSerializer < BaseSerializer- attributes :id, :name, :code- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/shipping_rate_serializer.rb b/api/app/serializers/spree/api/v3/store/shipping_rate_serializer.rbdeleted file mode 100644index 0d4eb40440..0000000000--- a/api/app/serializers/spree/api/v3/store/shipping_rate_serializer.rb+++ /dev/null@@ -1,21 +0,0 @@-module Spree- module Api- module V3- module Store- class ShippingRateSerializer < BaseSerializer- attributes :id, :name, :selected, :shipping_method_id-- attribute :cost do |shipping_rate|- shipping_rate.cost.to_f- end-- attribute :display_cost do |shipping_rate|- shipping_rate.display_cost.to_s- end-- one :shipping_method, resource: Spree.api.v3_store_shipping_method_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/state_serializer.rb b/api/app/serializers/spree/api/v3/store/state_serializer.rbdeleted file mode 100644index 9dda1f1c57..0000000000--- a/api/app/serializers/spree/api/v3/store/state_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class StateSerializer < BaseSerializer- attributes :id, :name, :abbr, :country_id- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/stock_location_serializer.rb b/api/app/serializers/spree/api/v3/store/stock_location_serializer.rbdeleted file mode 100644index 8ebb58c0d7..0000000000--- a/api/app/serializers/spree/api/v3/store/stock_location_serializer.rb+++ /dev/null@@ -1,11 +0,0 @@-module Spree- module Api- module V3- module Store- class StockLocationSerializer < BaseSerializer- attributes :id, :name, :address1, :city, :zipcode, :country_id, :country_iso, :country_name, :state_id, :state_text- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/store_serializer.rb b/api/app/serializers/spree/api/v3/store/store_serializer.rbdeleted file mode 100644index fcfb20989b..0000000000--- a/api/app/serializers/spree/api/v3/store/store_serializer.rb+++ /dev/null@@ -1,39 +0,0 @@-module Spree- module Api- module V3- module Store- class StoreSerializer < BaseSerializer- attributes :id, :name, :url, :meta_description, :meta_keywords, :seo_title,- :default_currency, :code, :default, :facebook, :twitter,- :instagram, :customer_support_email, :default_locale-- attribute :supported_currencies do |store|- store.supported_currencies_list.map(&:iso_code)- end-- attribute :favicon_image_url do |store|- image_url_for(store.favicon_image)- end-- attribute :logo_image_url do |store|- image_url_for(store.logo)- end-- attribute :social_image_url do |store|- image_url_for(store.social_image)- end-- attribute :supported_locales do |store|- store.supported_locales_list- end-- many :payment_methods,- proc { |payment_methods, _params|- payment_methods.select { |pm| pm.available_on_front_end? && pm.active? }- },- resource: Spree.api.v3_store_payment_method_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/taxon_serializer.rb b/api/app/serializers/spree/api/v3/store/taxon_serializer.rbdeleted file mode 100644index a9d26423bc..0000000000--- a/api/app/serializers/spree/api/v3/store/taxon_serializer.rb+++ /dev/null@@ -1,50 +0,0 @@-module Spree- module Api- module V3- module Store- class TaxonSerializer < BaseSerializer- attributes :id, :name, :permalink, :position, :lft, :rgt, :depth,- :meta_title, :meta_description, :meta_keywords,- :parent_id, :taxonomy_id, :children_count-- attribute :description do |taxon|- taxon.description.to_plain_text- end-- attribute :description_html do |taxon|- taxon.description.to_s- end-- attribute :image_url do |taxon|- image_url_for(taxon.image)- end-- attribute :square_image_url do |taxon|- image_url_for(taxon.square_image)- end-- attribute :is_root do |taxon|- taxon.root?- end-- attribute :is_child do |taxon|- taxon.child?- end-- attribute :is_leaf do |taxon|- taxon.leaf?- end-- # Conditional associations- one :parent,- resource: Spree.api.v3_store_taxon_serializer,- if: proc { params[:includes]&.include?('parent') }-- many :children,- resource: Spree.api.v3_store_taxon_serializer,- if: proc { params[:includes]&.include?('children') }- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/taxonomy_serializer.rb b/api/app/serializers/spree/api/v3/store/taxonomy_serializer.rbdeleted file mode 100644index b3e87cf5da..0000000000--- a/api/app/serializers/spree/api/v3/store/taxonomy_serializer.rb+++ /dev/null@@ -1,20 +0,0 @@-module Spree- module Api- module V3- module Store- class TaxonomySerializer < BaseSerializer- attributes :id, :name, :position-- # Conditional associations- one :root,- resource: Spree.api.v3_store_taxon_serializer,- if: proc { params[:includes]&.include?('root') }-- many :taxons,- resource: Spree.api.v3_store_taxon_serializer,- if: proc { params[:includes]&.include?('taxons') }- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/user_serializer.rb b/api/app/serializers/spree/api/v3/store/user_serializer.rbdeleted file mode 100644index 577b477951..0000000000--- a/api/app/serializers/spree/api/v3/store/user_serializer.rb+++ /dev/null@@ -1,15 +0,0 @@-module Spree- module Api- module V3- module Store- class UserSerializer < BaseSerializer- attributes :id, :email, :first_name, :last_name-- many :addresses, resource: Spree.api.v3_store_address_serializer- one :default_billing_address, resource: Spree.api.v3_store_address_serializer- one :default_shipping_address, resource: Spree.api.v3_store_address_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/variant_serializer.rb b/api/app/serializers/spree/api/v3/store/variant_serializer.rbdeleted file mode 100644index fc3245f795..0000000000--- a/api/app/serializers/spree/api/v3/store/variant_serializer.rb+++ /dev/null@@ -1,75 +0,0 @@-module Spree- module Api- module V3- module Store- class VariantSerializer < BaseSerializer- attributes :id, :product_id, :sku, :barcode, :is_master, :options_text, :track_inventory, :image_count-- attribute :purchasable do |variant|- variant.purchasable?- end-- attribute :in_stock do |variant|- variant.in_stock?- end-- attribute :backorderable do |variant|- variant.backorderable?- end-- attribute :weight do |variant|- variant.weight&.to_f- end-- attribute :height do |variant|- variant.height&.to_f- end-- attribute :width do |variant|- variant.width&.to_f- end-- attribute :depth do |variant|- variant.depth&.to_f- end-- attribute :price do |variant|- price_object(variant)&.amount&.to_f- end-- attribute :price_in_cents do |variant|- price_object(variant)&.display_amount&.amount_in_cents- end-- attribute :display_price do |variant|- price_object(variant)&.display_price&.to_s- end-- attribute :compare_at_price do |variant|- price_object(variant)&.compare_at_amount&.to_f- end-- attribute :display_compare_at_price do |variant|- price = price_object(variant)- next unless price&.compare_at_amount-- Spree::Money.new(price.compare_at_amount, currency: currency).to_s- end-- # Conditional associations- many :images,- resource: Spree.api.v3_store_image_serializer,- if: proc { params[:includes]&.include?('images') }-- many :option_values, resource: Spree.api.v3_store_option_value_serializer-- private-- def price_object(variant)- @price_object ||= price_for(variant)- end- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/wished_item_serializer.rb b/api/app/serializers/spree/api/v3/store/wished_item_serializer.rbdeleted file mode 100644index e10cca4e0c..0000000000--- a/api/app/serializers/spree/api/v3/store/wished_item_serializer.rb+++ /dev/null@@ -1,13 +0,0 @@-module Spree- module Api- module V3- module Store- class WishedItemSerializer < BaseSerializer- attributes :id, :variant_id, :wishlist_id, :quantity-- one :variant, resource: Spree.api.v3_store_variant_serializer- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store/wishlist_serializer.rb b/api/app/serializers/spree/api/v3/store/wishlist_serializer.rbdeleted file mode 100644index fc650054cc..0000000000--- a/api/app/serializers/spree/api/v3/store/wishlist_serializer.rb+++ /dev/null@@ -1,24 +0,0 @@-module Spree- module Api- module V3- module Store- class WishlistSerializer < BaseSerializer- attributes :id, :name, :token-- attribute :is_default do |wishlist|- wishlist.is_default?- end-- attribute :is_private do |wishlist|- wishlist.is_private?- end-- many :wished_items,- key: :items,- resource: Spree.api.v3_store_wished_item_serializer,- if: proc { params[:includes]&.include?('items') }- end- end- end- end-enddiff --git a/api/app/serializers/spree/api/v3/store_serializer.rb b/api/app/serializers/spree/api/v3/store_serializer.rbnew file mode 100644index 0000000000..8b15e75bcb--- /dev/null+++ b/api/app/serializers/spree/api/v3/store_serializer.rb@@ -0,0 +1,43 @@+module Spree+ module Api+ module V3+ class StoreSerializer < BaseSerializer+ typelize_from Spree::Store+ typelize supported_currencies: 'string[]', favicon_image_url: 'string | null',+ logo_image_url: 'string | null', social_image_url: 'string | null',+ supported_locales: 'string[]'++ attributes :id, :name, :url, :meta_description, :meta_keywords, :seo_title,+ :default_currency, :code, :default, :facebook, :twitter,+ :instagram, :customer_support_email, :default_locale,+ created_at: :iso8601, updated_at: :iso8601++ attribute :supported_currencies do |store|+ store.supported_currencies_list.map(&:iso_code)+ end++ attribute :favicon_image_url do |store|+ image_url_for(store.favicon_image)+ end++ attribute :logo_image_url do |store|+ image_url_for(store.logo)+ end++ attribute :social_image_url do |store|+ image_url_for(store.social_image)+ end++ attribute :supported_locales do |store|+ store.supported_locales_list+ end++ many :payment_methods,+ proc { |payment_methods, _params|+ payment_methods.select { |pm| pm.available_on_front_end? && pm.active? }+ },+ resource: Spree.api.payment_method_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/taxon_serializer.rb b/api/app/serializers/spree/api/v3/taxon_serializer.rbnew file mode 100644index 0000000000..11a274af87--- /dev/null+++ b/api/app/serializers/spree/api/v3/taxon_serializer.rb@@ -0,0 +1,54 @@+module Spree+ module Api+ module V3+ class TaxonSerializer < BaseSerializer+ typelize_from Spree::Taxon+ typelize description: :string, description_html: :string,+ image_url: 'string | null', square_image_url: 'string | null',+ is_root: :boolean, is_child: :boolean, is_leaf: :boolean++ attributes :id, :name, :permalink, :position, :lft, :rgt, :depth,+ :meta_title, :meta_description, :meta_keywords,+ :parent_id, :taxonomy_id, :children_count,+ created_at: :iso8601, updated_at: :iso8601++ attribute :description do |taxon|+ taxon.description.to_plain_text+ end++ attribute :description_html do |taxon|+ taxon.description.to_s+ end++ attribute :image_url do |taxon|+ image_url_for(taxon.image)+ end++ attribute :square_image_url do |taxon|+ image_url_for(taxon.square_image)+ end++ attribute :is_root do |taxon|+ taxon.root?+ end++ attribute :is_child do |taxon|+ taxon.child?+ end++ attribute :is_leaf do |taxon|+ taxon.leaf?+ end++ # Conditional associations+ one :parent,+ resource: Spree.api.taxon_serializer,+ if: proc { params[:includes]&.include?('parent') }++ many :children,+ resource: Spree.api.taxon_serializer,+ if: proc { params[:includes]&.include?('children') }+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/taxonomy_serializer.rb b/api/app/serializers/spree/api/v3/taxonomy_serializer.rbnew file mode 100644index 0000000000..c067b03380--- /dev/null+++ b/api/app/serializers/spree/api/v3/taxonomy_serializer.rb@@ -0,0 +1,21 @@+module Spree+ module Api+ module V3+ class TaxonomySerializer < BaseSerializer+ typelize_from Spree::Taxonomy++ attributes :id, :name, :position,+ created_at: :iso8601, updated_at: :iso8601++ # Conditional associations+ one :root,+ resource: Spree.api.taxon_serializer,+ if: proc { params[:includes]&.include?('root') }++ many :taxons,+ resource: Spree.api.taxon_serializer,+ if: proc { params[:includes]&.include?('taxons') }+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/user_serializer.rb b/api/app/serializers/spree/api/v3/user_serializer.rbnew file mode 100644index 0000000000..52107d9352--- /dev/null+++ b/api/app/serializers/spree/api/v3/user_serializer.rb@@ -0,0 +1,18 @@+module Spree+ module Api+ module V3+ # Store API User Serializer+ # Customer-facing user data+ class UserSerializer < BaseSerializer+ # Note: Using Spree.user_class dynamically, typelize_from not applicable here++ attributes :id, :email, :first_name, :last_name,+ created_at: :iso8601, updated_at: :iso8601++ many :addresses, resource: Spree.api.address_serializer+ one :bill_address, key: :default_billing_address, resource: Spree.api.address_serializer+ one :ship_address, key: :default_shipping_address, resource: Spree.api.address_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/variant_serializer.rb b/api/app/serializers/spree/api/v3/variant_serializer.rbnew file mode 100644index 0000000000..f9300d4f3b--- /dev/null+++ b/api/app/serializers/spree/api/v3/variant_serializer.rb@@ -0,0 +1,83 @@+module Spree+ module Api+ module V3+ # Store API Variant Serializer+ # Customer-facing variant data with limited fields+ class VariantSerializer < BaseSerializer+ typelize_from Spree::Variant++ typelize purchasable: :boolean, in_stock: :boolean, backorderable: :boolean,+ weight: 'number | null', height: 'number | null', width: 'number | null', depth: 'number | null',+ price: 'number | null', price_in_cents: 'number | null', display_price: 'string | null',+ compare_at_price: 'number | null', display_compare_at_price: 'string | null'++ attributes :id, :product_id, :sku, :barcode, :is_master, :options_text, :track_inventory, :image_count,+ created_at: :iso8601, updated_at: :iso8601++ attribute :purchasable do |variant|+ variant.purchasable?+ end++ attribute :in_stock do |variant|+ variant.in_stock?+ end++ attribute :backorderable do |variant|+ variant.backorderable?+ end++ attribute :weight do |variant|+ variant.weight&.to_f+ end++ attribute :height do |variant|+ variant.height&.to_f+ end++ attribute :width do |variant|+ variant.width&.to_f+ end++ attribute :depth do |variant|+ variant.depth&.to_f+ end++ attribute :price do |variant|+ price_object(variant)&.amount&.to_f+ end++ attribute :price_in_cents do |variant|+ price_object(variant)&.display_amount&.amount_in_cents+ end++ attribute :display_price do |variant|+ price_object(variant)&.display_price&.to_s+ end++ attribute :compare_at_price do |variant|+ price_object(variant)&.compare_at_amount&.to_f+ end++ attribute :display_compare_at_price do |variant|+ price = price_object(variant)+ next unless price&.compare_at_amount++ Spree::Money.new(price.compare_at_amount, currency: current_currency).to_s+ end++ # Conditional associations+ many :images,+ resource: Spree.api.image_serializer,+ if: proc { params[:includes]&.include?('images') }++ many :option_values, resource: Spree.api.option_value_serializer++ private++ def price_object(variant)+ @price_object ||= price_for(variant)+ end+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/wished_item_serializer.rb b/api/app/serializers/spree/api/v3/wished_item_serializer.rbnew file mode 100644index 0000000000..000d3282b9--- /dev/null+++ b/api/app/serializers/spree/api/v3/wished_item_serializer.rb@@ -0,0 +1,14 @@+module Spree+ module Api+ module V3+ class WishedItemSerializer < BaseSerializer+ typelize_from Spree::WishedItem++ attributes :id, :variant_id, :wishlist_id, :quantity,+ created_at: :iso8601, updated_at: :iso8601++ one :variant, resource: Spree.api.variant_serializer+ end+ end+ end+enddiff --git a/api/app/serializers/spree/api/v3/wishlist_serializer.rb b/api/app/serializers/spree/api/v3/wishlist_serializer.rbnew file mode 100644index 0000000000..697412c84d--- /dev/null+++ b/api/app/serializers/spree/api/v3/wishlist_serializer.rb@@ -0,0 +1,26 @@+module Spree+ module Api+ module V3+ class WishlistSerializer < BaseSerializer+ typelize_from Spree::Wishlist+ typelize is_default: :boolean, is_private: :boolean++ attributes :id, :name, :token,+ created_at: :iso8601, updated_at: :iso8601++ attribute :is_default do |wishlist|+ wishlist.is_default?+ end++ attribute :is_private do |wishlist|+ wishlist.is_private?+ end++ many :wished_items,+ key: :items,+ resource: Spree.api.wished_item_serializer,+ if: proc { params[:includes]&.include?('items') }+ end+ end+ end+enddiff --git a/api/lib/spree/api.rb b/api/lib/spree/api.rbindex d9b200ef8b..d507c8b36e 100644--- a/api/lib/spree/api.rb+++ b/api/lib/spree/api.rb@@ -4,6 +4,7 @@ require 'doorkeeper'require 'pagy'require 'alba'require 'oj'+require 'typelizer'module Spreemodule Apidiff --git a/api/lib/spree/api/dependencies.rb b/api/lib/spree/api/dependencies.rbindex 4367b4e285..0207959898 100644--- a/api/lib/spree/api/dependencies.rb+++ b/api/lib/spree/api/dependencies.rb@@ -90,33 +90,33 @@ module Spreestorefront_wished_item_serializer: 'Spree::V2::Storefront::WishedItemSerializer',storefront_metafield_serializer: 'Spree::V2::Storefront::MetafieldSerializer',- # v3 storefront serializers- v3_store_credit_card_serializer: 'Spree::Api::V3::Store::CreditCardSerializer',- v3_store_product_serializer: 'Spree::Api::V3::Store::ProductSerializer',- v3_store_variant_serializer: 'Spree::Api::V3::Store::VariantSerializer',- v3_store_image_serializer: 'Spree::Api::V3::Store::ImageSerializer',- v3_store_option_type_serializer: 'Spree::Api::V3::Store::OptionTypeSerializer',- v3_store_option_value_serializer: 'Spree::Api::V3::Store::OptionValueSerializer',- v3_store_order_serializer: 'Spree::Api::V3::Store::OrderSerializer',- v3_store_line_item_serializer: 'Spree::Api::V3::Store::LineItemSerializer',- v3_store_payment_serializer: 'Spree::Api::V3::Store::PaymentSerializer',- v3_store_payment_source_serializer: 'Spree::Api::V3::Store::PaymentSourceSerializer',- v3_store_shipment_serializer: 'Spree::Api::V3::Store::ShipmentSerializer',- v3_store_address_serializer: 'Spree::Api::V3::Store::AddressSerializer',- v3_store_user_serializer: 'Spree::Api::V3::Store::UserSerializer',- v3_store_country_serializer: 'Spree::Api::V3::Store::CountrySerializer',- v3_store_state_serializer: 'Spree::Api::V3::Store::StateSerializer',- v3_store_store_serializer: 'Spree::Api::V3::Store::StoreSerializer',- v3_store_wishlist_serializer: 'Spree::Api::V3::Store::WishlistSerializer',- v3_store_wished_item_serializer: 'Spree::Api::V3::Store::WishedItemSerializer',- v3_store_payment_method_serializer: 'Spree::Api::V3::Store::PaymentMethodSerializer',- v3_store_shipping_method_serializer: 'Spree::Api::V3::Store::ShippingMethodSerializer',- v3_store_shipping_rate_serializer: 'Spree::Api::V3::Store::ShippingRateSerializer',- v3_store_stock_location_serializer: 'Spree::Api::V3::Store::StockLocationSerializer',- v3_store_taxonomy_serializer: 'Spree::Api::V3::Store::TaxonomySerializer',- v3_store_taxon_serializer: 'Spree::Api::V3::Store::TaxonSerializer',- v3_store_order_promotion_serializer: 'Spree::Api::V3::Store::OrderPromotionSerializer',- v3_store_digital_link_serializer: 'Spree::Api::V3::Store::DigitalLinkSerializer',+ # v3 serializers (API v3)+ credit_card_serializer: 'Spree::Api::V3::CreditCardSerializer',+ product_serializer: 'Spree::Api::V3::ProductSerializer',+ variant_serializer: 'Spree::Api::V3::VariantSerializer',+ image_serializer: 'Spree::Api::V3::ImageSerializer',+ option_type_serializer: 'Spree::Api::V3::OptionTypeSerializer',+ option_value_serializer: 'Spree::Api::V3::OptionValueSerializer',+ order_serializer: 'Spree::Api::V3::OrderSerializer',+ line_item_serializer: 'Spree::Api::V3::LineItemSerializer',+ payment_serializer: 'Spree::Api::V3::PaymentSerializer',+ payment_source_serializer: 'Spree::Api::V3::PaymentSourceSerializer',+ shipment_serializer: 'Spree::Api::V3::ShipmentSerializer',+ address_serializer: 'Spree::Api::V3::AddressSerializer',+ user_serializer: 'Spree::Api::V3::UserSerializer',+ country_serializer: 'Spree::Api::V3::CountrySerializer',+ state_serializer: 'Spree::Api::V3::StateSerializer',+ store_serializer: 'Spree::Api::V3::StoreSerializer',+ wishlist_serializer: 'Spree::Api::V3::WishlistSerializer',+ wished_item_serializer: 'Spree::Api::V3::WishedItemSerializer',+ payment_method_serializer: 'Spree::Api::V3::PaymentMethodSerializer',+ shipping_method_serializer: 'Spree::Api::V3::ShippingMethodSerializer',+ shipping_rate_serializer: 'Spree::Api::V3::ShippingRateSerializer',+ stock_location_serializer: 'Spree::Api::V3::StockLocationSerializer',+ taxonomy_serializer: 'Spree::Api::V3::TaxonomySerializer',+ taxon_serializer: 'Spree::Api::V3::TaxonSerializer',+ order_promotion_serializer: 'Spree::Api::V3::OrderPromotionSerializer',+ digital_link_serializer: 'Spree::Api::V3::DigitalLinkSerializer',# platform serializersplatform_metafield_serializer: 'Spree::Api::V2::Platform::MetafieldSerializer',diff --git a/api/lib/spree/api/engine.rb b/api/lib/spree/api/engine.rbindex b58af3e1d8..d5cd763803 100644--- a/api/lib/spree/api/engine.rb+++ b/api/lib/spree/api/engine.rb@@ -19,6 +19,32 @@ module SpreeMigrations.new(config, engine_name).check unless Rails.env.test?end+ # Configure typelizer for TypeScript type generation+ # Runs after typelizer.configure so we can override defaults+ initializer 'spree.api.typelizer', after: 'typelizer.configure' do+ next unless defined?(Typelizer)++ api_root = Spree::Api::Engine.root++ Typelizer.configure do |config|+ config.dirs = [+ api_root.join('app/serializers/spree/api/v3'),+ api_root.join('app/serializers/spree/api/v3/admin')+ ]+ config.output_dir = api_root.join('../sdk/src/types/generated')+ config.comments = true++ # Type names: StoreProduct, AdminProduct, etc.+ config.serializer_name_mapper = ->(serializer) {+ name = serializer.name.to_s+ .sub(/\ASpree::Api::V3::Admin::/, 'Admin')+ .sub(/\ASpree::Api::V3::/, 'Store')+ .sub(/Serializer\z/, '')+ name+ }+ end+ end+# Add API event subscribersconfig.after_initialize doSpree.subscribers << Spree::WebhookEventSubscriberdiff --git a/api/spec/serializers/spree/api/v3/product_serializer_spec.rb b/api/spec/serializers/spree/api/v3/product_serializer_spec.rbnew file mode 100644index 0000000000..5dfd7c7a9b--- /dev/null+++ b/api/spec/serializers/spree/api/v3/product_serializer_spec.rb@@ -0,0 +1,57 @@+require 'spec_helper'++RSpec.describe Spree::Api::V3::ProductSerializer do+ let(:store) { @default_store }+ let(:product) { create(:product, stores: [store]) }+ let(:base_params) { { store: store, currency: 'USD' } }++ describe 'store serializer' do+ subject { described_class.new(product, params: base_params).to_h }++ it 'includes standard attributes' do+ expect(subject).to include(+ 'id' => product.id,+ 'name' => product.name,+ 'slug' => product.slug+ )+ end++ it 'includes timestamps' do+ expect(subject).to have_key('created_at')+ expect(subject).to have_key('updated_at')+ end++ it 'does not include admin-only attributes' do+ expect(subject).not_to have_key('cost_price')+ expect(subject).not_to have_key('cost_currency')+ expect(subject).not_to have_key('private_metadata')+ expect(subject).not_to have_key('deleted_at')+ end+ end+end++RSpec.describe Spree::Api::V3::Admin::ProductSerializer do+ let(:store) { @default_store }+ let(:product) { create(:product, stores: [store]) }+ let(:base_params) { { store: store, currency: 'USD' } }++ describe 'admin serializer' do+ subject { described_class.new(product, params: base_params).to_h }++ it 'includes standard attributes' do+ expect(subject).to include(+ 'id' => product.id,+ 'name' => product.name,+ 'slug' => product.slug+ )+ end++ it 'includes admin-only attributes' do+ expect(subject).to have_key('cost_price')+ expect(subject).to have_key('cost_currency')+ expect(subject).to have_key('private_metadata')+ expect(subject).to have_key('public_metadata')+ expect(subject).to have_key('deleted_at')+ end+ end+enddiff --git a/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb b/api/spec/serializers/spree/api/v3/variant_serializer_spec.rbnew file mode 100644index 0000000000..54b4ea77fe--- /dev/null+++ b/api/spec/serializers/spree/api/v3/variant_serializer_spec.rb@@ -0,0 +1,61 @@+require 'spec_helper'++RSpec.describe Spree::Api::V3::VariantSerializer do+ let(:store) { @default_store }+ let(:product) { create(:product, stores: [store]) }+ let(:variant) { create(:variant, product: product) }+ let(:base_params) { { store: store, currency: 'USD' } }++ describe 'store serializer' do+ subject { described_class.new(variant, params: base_params).to_h }++ it 'includes standard attributes' do+ expect(subject).to include(+ 'id' => variant.id,+ 'sku' => variant.sku,+ 'product_id' => product.id+ )+ end++ it 'includes timestamps' do+ expect(subject).to have_key('created_at')+ expect(subject).to have_key('updated_at')+ end++ it 'does not include admin-only attributes' do+ expect(subject).not_to have_key('cost_price')+ expect(subject).not_to have_key('cost_currency')+ expect(subject).not_to have_key('private_metadata')+ expect(subject).not_to have_key('total_on_hand')+ expect(subject).not_to have_key('deleted_at')+ end+ end+end++RSpec.describe Spree::Api::V3::Admin::VariantSerializer do+ let(:store) { @default_store }+ let(:product) { create(:product, stores: [store]) }+ let(:variant) { create(:variant, product: product) }+ let(:base_params) { { store: store, currency: 'USD' } }++ describe 'admin serializer' do+ subject { described_class.new(variant, params: base_params).to_h }++ it 'includes standard attributes' do+ expect(subject).to include(+ 'id' => variant.id,+ 'sku' => variant.sku,+ 'product_id' => product.id+ )+ end++ it 'includes admin-only attributes' do+ expect(subject).to have_key('cost_price')+ expect(subject).to have_key('cost_currency')+ expect(subject).to have_key('private_metadata')+ expect(subject).to have_key('public_metadata')+ expect(subject).to have_key('total_on_hand')+ expect(subject).to have_key('deleted_at')+ end+ end+enddiff --git a/api/spree_api.gemspec b/api/spree_api.gemspecindex 1b19e5e688..1cfd70cb00 100644--- a/api/spree_api.gemspec+++ b/api/spree_api.gemspec@@ -33,5 +33,7 @@ Gem::Specification.new do |s|s.add_dependency 'jsonapi-serializer', '~> 2.1's.add_dependency 'oj', '~> 3.16's.add_dependency 'pagy', '~> 43.0'+ s.add_dependency 'typelizer', '~> 0.7'+s.add_dependency 'spree_core', s.versionenddiff --git a/sdk/src/types/generated/AdminOrder.ts b/sdk/src/types/generated/AdminOrder.tsnew file mode 100644index 0000000000..8e34663863--- /dev/null+++ b/sdk/src/types/generated/AdminOrder.ts@@ -0,0 +1,59 @@+// Typelizer digest 621a20e3696634fea2bb3bd289cd9aa6+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreOrderPromotion, StoreLineItem, StoreShipment, StorePayment, StoreAddress, StorePaymentMethod, AdminUser} from '@/types'++type AdminOrder = {+ id: number;+ number: string | null;+ state: string | null;+ token: string | null;+ email: string | null;+ special_instructions: string | null;+ currency: string | null;+ item_count: number | null;+ shipment_state: string | null;+ payment_state: string | null;+ item_total: number;+ display_item_total: unknown;+ ship_total: unknown;+ display_ship_total: unknown;+ adjustment_total: number;+ display_adjustment_total: unknown;+ promo_total: number | null;+ display_promo_total: unknown;+ tax_total: unknown;+ display_tax_total: unknown;+ included_tax_total: number;+ display_included_tax_total: unknown;+ additional_tax_total: number | null;+ display_additional_tax_total: unknown;+ total: number;+ display_total: unknown;+ completed_at: string | null;+ created_at: string;+ updated_at: string;+ order_promotions?: Array<StoreOrderPromotion>;+ line_items?: Array<StoreLineItem>;+ shipments?: Array<StoreShipment>;+ payments?: Array<StorePayment>;+ bill_address?: StoreAddress | null;+ ship_address?: StoreAddress | null;+ payment_methods: Array<StorePaymentMethod>;+ channel: string | null;+ last_ip_address: string | null;+ considered_risky: boolean | null;+ confirmation_delivered: boolean | null;+ store_owner_notification_delivered: boolean | null;+ internal_note: string | null;+ approver_id: number | null;+ canceled_at: string | null;+ approved_at: string | null;+ canceler_id: string | null;+ created_by_id: string | null;+ public_metadata: Record<string, unknown> | null;+ private_metadata: Record<string, unknown> | null;+ user?: AdminUser | null;+}++export default AdminOrder;diff --git a/sdk/src/types/generated/AdminProduct.ts b/sdk/src/types/generated/AdminProduct.tsnew file mode 100644index 0000000000..b257e123e1--- /dev/null+++ b/sdk/src/types/generated/AdminProduct.ts@@ -0,0 +1,45 @@+// Typelizer digest 2353883ed6b1ae57431c11322b93fbfb+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreImage, AdminVariant, StoreOptionType, StoreTaxon} from '@/types'++type AdminProduct = {+ id: number;+ name: string;+ description: string | null;+ slug: string | null;+ sku: string | null;+ barcode: string | null;+ meta_description: string | null;+ meta_keywords: string | null;+ available_on: string | null;+ created_at: string;+ updated_at: string;+ purchasable: boolean;+ in_stock: boolean;+ backorderable: boolean;+ available: boolean;+ price: number | null;+ price_in_cents: number | null;+ display_price: string | null;+ compare_at_price: number | null;+ compare_at_price_in_cents: number | null;+ display_compare_at_price: string | null;+ tags: Array<string>;+ images?: Array<StoreImage>;+ variants?: Array<AdminVariant>;+ default_variant?: AdminVariant;+ master_variant?: AdminVariant | null;+ option_types?: Array<StoreOptionType>;+ taxons?: Array<StoreTaxon>;+ status: string;+ make_active_at: string | null;+ discontinue_on: string | null;+ deleted_at: string | null;+ cost_price: number | null;+ cost_currency: string | null;+ public_metadata: Record<string, unknown> | null;+ private_metadata: Record<string, unknown> | null;+}++export default AdminProduct;diff --git a/sdk/src/types/generated/AdminUser.ts b/sdk/src/types/generated/AdminUser.tsnew file mode 100644index 0000000000..46db557b2f--- /dev/null+++ b/sdk/src/types/generated/AdminUser.ts@@ -0,0 +1,30 @@+// Typelizer digest 8a9222e05a9be35155c50bdf77359390+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreAddress, AdminOrder} from '@/types'++type AdminUser = {+ id: unknown;+ email: unknown;+ first_name: unknown;+ last_name: unknown;+ created_at: unknown;+ updated_at: unknown;+ addresses: Array<StoreAddress>;+ default_billing_address: StoreAddress;+ default_shipping_address: StoreAddress;+ phone: unknown;+ login: unknown;+ accepts_email_marketing: unknown;+ last_sign_in_at: unknown;+ current_sign_in_at: unknown;+ sign_in_count: unknown;+ failed_attempts: unknown;+ last_sign_in_ip: unknown;+ current_sign_in_ip: unknown;+ public_metadata: unknown;+ private_metadata: unknown;+ orders?: Array<AdminOrder>;+}++export default AdminUser;diff --git a/sdk/src/types/generated/AdminVariant.ts b/sdk/src/types/generated/AdminVariant.tsnew file mode 100644index 0000000000..424e255184--- /dev/null+++ b/sdk/src/types/generated/AdminVariant.ts@@ -0,0 +1,41 @@+// Typelizer digest 4f90352bab2f3a649de4441bdd2c8c76+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreImage, StoreOptionValue} from '@/types'++type AdminVariant = {+ id: number;+ product_id: number | null;+ sku: string;+ barcode: string | null;+ is_master: boolean | null;+ options_text: unknown;+ track_inventory: boolean | null;+ image_count: number;+ created_at: string;+ updated_at: string;+ purchasable: boolean;+ in_stock: boolean;+ backorderable: boolean;+ weight: number | null;+ height: number | null;+ width: number | null;+ depth: number | null;+ price: number | null;+ price_in_cents: number | null;+ display_price: string | null;+ compare_at_price: number | null;+ display_compare_at_price: string | null;+ images?: Array<StoreImage>;+ option_values: Array<StoreOptionValue>;+ position: number | null;+ tax_category_id: number | null;+ deleted_at: string | null;+ cost_price: number | null;+ cost_currency: string | null;+ total_on_hand: number | null;+ public_metadata: Record<string, unknown> | null;+ private_metadata: Record<string, unknown> | null;+}++export default AdminVariant;diff --git a/sdk/src/types/generated/StoreAddress.ts b/sdk/src/types/generated/StoreAddress.tsnew file mode 100644index 0000000000..2044129d9f--- /dev/null+++ b/sdk/src/types/generated/StoreAddress.ts@@ -0,0 +1,23 @@+// Typelizer digest 8a9651c9a48de75043e54145a1c721f9+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreAddress = {+ id: number;+ firstname: string | null;+ lastname: string | null;+ full_name: string;+ address1: string | null;+ address2: string | null;+ city: string | null;+ zipcode: string | null;+ phone: string | null;+ company: string | null;+ state_id: number | null;+ state_text: string | null;+ country_id: number | null;+ country_iso: string;+ country_name: string;+}++export default StoreAddress;diff --git a/sdk/src/types/generated/StoreCountry.ts b/sdk/src/types/generated/StoreCountry.tsnew file mode 100644index 0000000000..27c37b2208--- /dev/null+++ b/sdk/src/types/generated/StoreCountry.ts@@ -0,0 +1,17 @@+// Typelizer digest 4ffcbab8736f41bc51ebb9763f8710d0+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreState} from '@/types'++type StoreCountry = {+ id: number;+ iso: string;+ iso3: string;+ iso_name: string | null;+ name: string | null;+ states_required: boolean | null;+ zipcode_required: boolean | null;+ states?: Array<StoreState>;+}++export default StoreCountry;diff --git a/sdk/src/types/generated/StoreDigitalLink.ts b/sdk/src/types/generated/StoreDigitalLink.tsnew file mode 100644index 0000000000..8c4df16ba3--- /dev/null+++ b/sdk/src/types/generated/StoreDigitalLink.ts@@ -0,0 +1,17 @@+// Typelizer digest 9bcffa0652882af352a11b41b2e962c4+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreDigitalLink = {+ id: number;+ access_counter: number | null;+ filename: string;+ content_type: string;+ created_at: string;+ updated_at: string;+ authorizable: boolean;+ expired: boolean;+ access_limit_exceeded: boolean;+}++export default StoreDigitalLink;diff --git a/sdk/src/types/generated/StoreImage.ts b/sdk/src/types/generated/StoreImage.tsnew file mode 100644index 0000000000..be7a88d6c9--- /dev/null+++ b/sdk/src/types/generated/StoreImage.ts@@ -0,0 +1,22 @@+// Typelizer digest 1125c6e391a9246fe138f57f9017ed48+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreImage = {+ id: number;+ position: number | null;+ alt: string | null;+ viewable_type: string | null;+ viewable_id: number | null;+ created_at: string | null;+ updated_at: string | null;+ original_url: string | null;+ mini_url: string | null;+ small_url: string | null;+ medium_url: string | null;+ large_url: string | null;+ xlarge_url: string | null;+ og_image_url: unknown;+}++export default StoreImage;diff --git a/sdk/src/types/generated/StoreLineItem.ts b/sdk/src/types/generated/StoreLineItem.tsnew file mode 100644index 0000000000..a762764a7c--- /dev/null+++ b/sdk/src/types/generated/StoreLineItem.ts@@ -0,0 +1,37 @@+// Typelizer digest b63c3ed2d43275e55e468d0491c4379b+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreImage, StoreOptionValue} from '@/types'++type StoreLineItem = {+ id: number;+ variant_id: number | null;+ quantity: number;+ name: string;+ slug: string;+ options_text: string;+ price: number;+ display_price: string;+ total: unknown;+ display_total: string;+ adjustment_total: number | null;+ display_adjustment_total: string;+ additional_tax_total: number | null;+ display_additional_tax_total: string;+ included_tax_total: number;+ display_included_tax_total: string;+ promo_total: number | null;+ display_promo_total: string;+ pre_tax_amount: number;+ display_pre_tax_amount: string;+ discounted_amount: unknown;+ display_discounted_amount: string;+ compare_at_amount: unknown;+ display_compare_at_amount: string | null;+ created_at: string;+ updated_at: string;+ images: Array<StoreImage>;+ option_values: Array<StoreOptionValue>;+}++export default StoreLineItem;diff --git a/sdk/src/types/generated/StoreOptionType.ts b/sdk/src/types/generated/StoreOptionType.tsnew file mode 100644index 0000000000..244ae4117e--- /dev/null+++ b/sdk/src/types/generated/StoreOptionType.ts@@ -0,0 +1,12 @@+// Typelizer digest 014cbc83094a11d92d60ee02c63c3265+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreOptionType = {+ id: number;+ name: string | null;+ presentation: string | null;+ position: number;+}++export default StoreOptionType;diff --git a/sdk/src/types/generated/StoreOptionValue.ts b/sdk/src/types/generated/StoreOptionValue.tsnew file mode 100644index 0000000000..9576033062--- /dev/null+++ b/sdk/src/types/generated/StoreOptionValue.ts@@ -0,0 +1,15 @@+// Typelizer digest f4b6aedb3ac38232ddffac53f31ca465+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreOptionValue = {+ id: number;+ name: string | null;+ presentation: string | null;+ position: number | null;+ option_type_id: number | null;+ option_type_name: string;+ option_type_presentation: string;+}++export default StoreOptionValue;diff --git a/sdk/src/types/generated/StoreOrder.ts b/sdk/src/types/generated/StoreOrder.tsnew file mode 100644index 0000000000..93f6549374--- /dev/null+++ b/sdk/src/types/generated/StoreOrder.ts@@ -0,0 +1,45 @@+// Typelizer digest 066e8fc1880547facdf45127b5c76748+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreOrderPromotion, StoreLineItem, StoreShipment, StorePayment, StoreAddress, StorePaymentMethod} from '@/types'++type StoreOrder = {+ id: number;+ number: string | null;+ state: string | null;+ token: string | null;+ email: string | null;+ special_instructions: string | null;+ currency: string | null;+ item_count: number | null;+ shipment_state: string | null;+ payment_state: string | null;+ item_total: number;+ display_item_total: unknown;+ ship_total: unknown;+ display_ship_total: unknown;+ adjustment_total: number;+ display_adjustment_total: unknown;+ promo_total: number | null;+ display_promo_total: unknown;+ tax_total: unknown;+ display_tax_total: unknown;+ included_tax_total: number;+ display_included_tax_total: unknown;+ additional_tax_total: number | null;+ display_additional_tax_total: unknown;+ total: number;+ display_total: unknown;+ completed_at: string | null;+ created_at: string;+ updated_at: string;+ order_promotions?: Array<StoreOrderPromotion>;+ line_items?: Array<StoreLineItem>;+ shipments?: Array<StoreShipment>;+ payments?: Array<StorePayment>;+ bill_address?: StoreAddress | null;+ ship_address?: StoreAddress | null;+ payment_methods: Array<StorePaymentMethod>;+}++export default StoreOrder;diff --git a/sdk/src/types/generated/StoreOrderPromotion.ts b/sdk/src/types/generated/StoreOrderPromotion.tsnew file mode 100644index 0000000000..9eade4a580--- /dev/null+++ b/sdk/src/types/generated/StoreOrderPromotion.ts@@ -0,0 +1,15 @@+// Typelizer digest 03063d4d8aecd511f71957b143225aca+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreOrderPromotion = {+ id: number;+ name: unknown;+ description: unknown;+ code: unknown;+ amount: unknown;+ display_amount: unknown;+ promotion_id: number | null;+}++export default StoreOrderPromotion;diff --git a/sdk/src/types/generated/StorePayment.ts b/sdk/src/types/generated/StorePayment.tsnew file mode 100644index 0000000000..92fd626448--- /dev/null+++ b/sdk/src/types/generated/StorePayment.ts@@ -0,0 +1,19 @@+// Typelizer digest 50e13b21b497d9c22d5174d4c0592b57+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StorePaymentMethod} from '@/types'++type StorePayment = {+ id: number;+ state: string | null;+ payment_method_id: number | null;+ response_code: string | null;+ number: string | null;+ amount: number;+ display_amount: unknown;+ created_at: string;+ updated_at: string;+ payment_method: StorePaymentMethod | null;+}++export default StorePayment;diff --git a/sdk/src/types/generated/StorePaymentMethod.ts b/sdk/src/types/generated/StorePaymentMethod.tsnew file mode 100644index 0000000000..d7afcc74c8--- /dev/null+++ b/sdk/src/types/generated/StorePaymentMethod.ts@@ -0,0 +1,12 @@+// Typelizer digest 139253df0b2e440e1c5541efba80a608+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StorePaymentMethod = {+ id: number;+ name: string | null;+ description: string | null;+ type: string | null;+}++export default StorePaymentMethod;diff --git a/sdk/src/types/generated/StoreProduct.ts b/sdk/src/types/generated/StoreProduct.tsnew file mode 100644index 0000000000..f978411c14--- /dev/null+++ b/sdk/src/types/generated/StoreProduct.ts@@ -0,0 +1,37 @@+// Typelizer digest 3bc94f86c634548d607f612aba9c4c60+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreImage, StoreVariant, StoreOptionType, StoreTaxon} from '@/types'++type StoreProduct = {+ id: number;+ name: string;+ description: string | null;+ slug: string | null;+ sku: string | null;+ barcode: string | null;+ meta_description: string | null;+ meta_keywords: string | null;+ available_on: string | null;+ created_at: string;+ updated_at: string;+ purchasable: boolean;+ in_stock: boolean;+ backorderable: boolean;+ available: boolean;+ price: number | null;+ price_in_cents: number | null;+ display_price: string | null;+ compare_at_price: number | null;+ compare_at_price_in_cents: number | null;+ display_compare_at_price: string | null;+ tags: Array<string>;+ images?: Array<StoreImage>;+ variants?: Array<StoreVariant>;+ default_variant?: StoreVariant;+ master_variant?: StoreVariant | null;+ option_types?: Array<StoreOptionType>;+ taxons?: Array<StoreTaxon>;+}++export default StoreProduct;diff --git a/sdk/src/types/generated/StoreShipment.ts b/sdk/src/types/generated/StoreShipment.tsnew file mode 100644index 0000000000..b9e16a8c4e--- /dev/null+++ b/sdk/src/types/generated/StoreShipment.ts@@ -0,0 +1,32 @@+// Typelizer digest 9f2de87cb55c8937f6daee4f425400eb+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreShippingMethod, StoreStockLocation, StoreShippingRate} from '@/types'++type StoreShipment = {+ id: number;+ number: string | null;+ state: string | null;+ tracking: string | null;+ tracking_url: unknown;+ shipped_at: string | null;+ cost: number | null;+ display_cost: unknown;+ adjustment_total: number | null;+ display_adjustment_total: unknown;+ additional_tax_total: number | null;+ display_additional_tax_total: unknown;+ promo_total: number | null;+ display_promo_total: unknown;+ included_tax_total: number;+ display_included_tax_total: unknown;+ total: unknown;+ display_total: unknown;+ created_at: string;+ updated_at: string;+ shipping_method: StoreShippingMethod;+ stock_location: StoreStockLocation | null;+ shipping_rates: Array<StoreShippingRate>;+}++export default StoreShipment;diff --git a/sdk/src/types/generated/StoreShippingMethod.ts b/sdk/src/types/generated/StoreShippingMethod.tsnew file mode 100644index 0000000000..feef329eea--- /dev/null+++ b/sdk/src/types/generated/StoreShippingMethod.ts@@ -0,0 +1,11 @@+// Typelizer digest ec108b36bb57d69f6b351bc1302132ce+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreShippingMethod = {+ id: number;+ name: string | null;+ code: string | null;+}++export default StoreShippingMethod;diff --git a/sdk/src/types/generated/StoreShippingRate.ts b/sdk/src/types/generated/StoreShippingRate.tsnew file mode 100644index 0000000000..b3bae54634--- /dev/null+++ b/sdk/src/types/generated/StoreShippingRate.ts@@ -0,0 +1,16 @@+// Typelizer digest fe022c44850889b384383066067e8f9c+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreShippingMethod} from '@/types'++type StoreShippingRate = {+ id: number;+ name: unknown;+ selected: boolean | null;+ shipping_method_id: number | null;+ cost: number;+ display_cost: string;+ shipping_method: StoreShippingMethod | null;+}++export default StoreShippingRate;diff --git a/sdk/src/types/generated/StoreState.ts b/sdk/src/types/generated/StoreState.tsnew file mode 100644index 0000000000..df6b54621f--- /dev/null+++ b/sdk/src/types/generated/StoreState.ts@@ -0,0 +1,12 @@+// Typelizer digest 38c61d5de29759fd1f5d4b7f0a575577+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreState = {+ id: number;+ name: string | null;+ abbr: string | null;+ country_id: number | null;+}++export default StoreState;diff --git a/sdk/src/types/generated/StoreStockLocation.ts b/sdk/src/types/generated/StoreStockLocation.tsnew file mode 100644index 0000000000..e65d3570ce--- /dev/null+++ b/sdk/src/types/generated/StoreStockLocation.ts@@ -0,0 +1,18 @@+// Typelizer digest a84a2cf41d8de60b7d04c36f6bce0ed4+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreStockLocation = {+ id: number;+ name: string | null;+ address1: string | null;+ city: string | null;+ zipcode: string | null;+ country_id: number | null;+ country_iso: unknown;+ country_name: unknown;+ state_id: number | null;+ state_text: unknown;+}++export default StoreStockLocation;diff --git a/sdk/src/types/generated/StoreStore.ts b/sdk/src/types/generated/StoreStore.tsnew file mode 100644index 0000000000..962549ca1d--- /dev/null+++ b/sdk/src/types/generated/StoreStore.ts@@ -0,0 +1,31 @@+// Typelizer digest 1d5491d5dd4ac78353d2cd2340fc415e+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StorePaymentMethod} from '@/types'++type StoreStore = {+ id: number;+ name: string | null;+ url: string | null;+ meta_description: string | null;+ meta_keywords: string | null;+ seo_title: string | null;+ default_currency: string | null;+ code: string | null;+ default: boolean;+ facebook: string | null;+ twitter: string | null;+ instagram: string | null;+ customer_support_email: string | null;+ default_locale: string | null;+ created_at: string;+ updated_at: string;+ supported_currencies: Array<string>;+ favicon_image_url: string | null;+ logo_image_url: string | null;+ social_image_url: string | null;+ supported_locales: Array<string>;+ payment_methods: Array<StorePaymentMethod>;+}++export default StoreStore;diff --git a/sdk/src/types/generated/StoreTaxon.ts b/sdk/src/types/generated/StoreTaxon.tsnew file mode 100644index 0000000000..407adddb18--- /dev/null+++ b/sdk/src/types/generated/StoreTaxon.ts@@ -0,0 +1,32 @@+// Typelizer digest aaf256cb7181023f5658edc824e7efb9+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.++type StoreTaxon = {+ id: number;+ name: string;+ permalink: string | null;+ position: number | null;+ lft: number | null;+ rgt: number | null;+ depth: number | null;+ meta_title: string | null;+ meta_description: string | null;+ meta_keywords: string | null;+ parent_id: number | null;+ taxonomy_id: number | null;+ children_count: number;+ created_at: string;+ updated_at: string;+ description: string;+ description_html: string;+ image_url: string | null;+ square_image_url: string | null;+ is_root: boolean;+ is_child: boolean;+ is_leaf: boolean;+ parent?: StoreTaxon | null;+ children?: Array<StoreTaxon>;+}++export default StoreTaxon;diff --git a/sdk/src/types/generated/StoreTaxonomy.ts b/sdk/src/types/generated/StoreTaxonomy.tsnew file mode 100644index 0000000000..3eb79039e2--- /dev/null+++ b/sdk/src/types/generated/StoreTaxonomy.ts@@ -0,0 +1,16 @@+// Typelizer digest 588c93c9b3d7a73e4ac241fd398ad048+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreTaxon} from '@/types'++type StoreTaxonomy = {+ id: number;+ name: string;+ position: number | null;+ created_at: string;+ updated_at: string;+ root?: StoreTaxon | null;+ taxons?: Array<StoreTaxon>;+}++export default StoreTaxonomy;diff --git a/sdk/src/types/generated/StoreUser.ts b/sdk/src/types/generated/StoreUser.tsnew file mode 100644index 0000000000..11d0669019--- /dev/null+++ b/sdk/src/types/generated/StoreUser.ts@@ -0,0 +1,18 @@+// Typelizer digest 5dda441c7b46d75d2b1075db3c3dba2a+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreAddress} from '@/types'++type StoreUser = {+ id: unknown;+ email: unknown;+ first_name: unknown;+ last_name: unknown;+ created_at: unknown;+ updated_at: unknown;+ addresses: Array<StoreAddress>;+ default_billing_address: StoreAddress;+ default_shipping_address: StoreAddress;+}++export default StoreUser;diff --git a/sdk/src/types/generated/StoreVariant.ts b/sdk/src/types/generated/StoreVariant.tsnew file mode 100644index 0000000000..cce6e16579--- /dev/null+++ b/sdk/src/types/generated/StoreVariant.ts@@ -0,0 +1,33 @@+// Typelizer digest b0a9c50180282eca412133e9281f7e76+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreImage, StoreOptionValue} from '@/types'++type StoreVariant = {+ id: number;+ product_id: number | null;+ sku: string;+ barcode: string | null;+ is_master: boolean | null;+ options_text: unknown;+ track_inventory: boolean | null;+ image_count: number;+ created_at: string;+ updated_at: string;+ purchasable: boolean;+ in_stock: boolean;+ backorderable: boolean;+ weight: number | null;+ height: number | null;+ width: number | null;+ depth: number | null;+ price: number | null;+ price_in_cents: number | null;+ display_price: string | null;+ compare_at_price: number | null;+ display_compare_at_price: string | null;+ images?: Array<StoreImage>;+ option_values: Array<StoreOptionValue>;+}++export default StoreVariant;diff --git a/sdk/src/types/generated/StoreWishedItem.ts b/sdk/src/types/generated/StoreWishedItem.tsnew file mode 100644index 0000000000..32806a738a--- /dev/null+++ b/sdk/src/types/generated/StoreWishedItem.ts@@ -0,0 +1,16 @@+// Typelizer digest 806f54742b2039394d020336196084d8+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreVariant} from '@/types'++type StoreWishedItem = {+ id: number;+ variant_id: number | null;+ wishlist_id: number | null;+ quantity: number;+ created_at: string;+ updated_at: string;+ variant: StoreVariant | null;+}++export default StoreWishedItem;diff --git a/sdk/src/types/generated/StoreWishlist.ts b/sdk/src/types/generated/StoreWishlist.tsnew file mode 100644index 0000000000..6281f4a696--- /dev/null+++ b/sdk/src/types/generated/StoreWishlist.ts@@ -0,0 +1,17 @@+// Typelizer digest 3af45a2f9591ccc2be4e92d41c4bcc5b+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+import type {StoreWishedItem} from '@/types'++type StoreWishlist = {+ id: number;+ name: string | null;+ token: string;+ created_at: string;+ updated_at: string;+ is_default: boolean;+ is_private: boolean;+ items?: Array<StoreWishedItem>;+}++export default StoreWishlist;diff --git a/sdk/src/types/generated/index.ts b/sdk/src/types/generated/index.tsnew file mode 100644index 0000000000..deb7115dba--- /dev/null+++ b/sdk/src/types/generated/index.ts@@ -0,0 +1,31 @@+// Typelizer digest eaede6c2b9fe19042800b59c03ac5e8c+//+// DO NOT MODIFY: This file was automatically generated by Typelizer.+export type { default as StoreAddress } from './StoreAddress'+export type { default as AdminOrder } from './AdminOrder'+export type { default as AdminProduct } from './AdminProduct'+export type { default as AdminUser } from './AdminUser'+export type { default as AdminVariant } from './AdminVariant'+export type { default as StoreCountry } from './StoreCountry'+export type { default as StoreDigitalLink } from './StoreDigitalLink'+export type { default as StoreImage } from './StoreImage'+export type { default as StoreLineItem } from './StoreLineItem'+export type { default as StoreOptionType } from './StoreOptionType'+export type { default as StoreOptionValue } from './StoreOptionValue'+export type { default as StoreOrderPromotion } from './StoreOrderPromotion'+export type { default as StoreOrder } from './StoreOrder'+export type { default as StorePaymentMethod } from './StorePaymentMethod'+export type { default as StorePayment } from './StorePayment'+export type { default as StoreProduct } from './StoreProduct'+export type { default as StoreShipment } from './StoreShipment'+export type { default as StoreShippingMethod } from './StoreShippingMethod'+export type { default as StoreShippingRate } from './StoreShippingRate'+export type { default as StoreState } from './StoreState'+export type { default as StoreStockLocation } from './StoreStockLocation'+export type { default as StoreStore } from './StoreStore'+export type { default as StoreTaxon } from './StoreTaxon'+export type { default as StoreTaxonomy } from './StoreTaxonomy'+export type { default as StoreUser } from './StoreUser'+export type { default as StoreVariant } from './StoreVariant'+export type { default as StoreWishedItem } from './StoreWishedItem'+export type { default as StoreWishlist } from './StoreWishlist'