Back to arkyStore.io

E-shop Types

E-commerce type definitions

Type definitions for the E-shop module.

Product

interface Product {
  id: string;
  key: string;
  store_id: string;
  slug: Record<string, string>;
  blocks: Block[];
  taxonomies: TaxonomyEntry[];
  variants: ProductVariant[];
  audience_ids: string[];
  status: Status;        // 'active' | 'archived'
  created_at: number;
  updated_at: number;
}
Note

Product display fields (name, description, images, price) live on blocks and variants rather than as fixed columns. Use the CMS block helpers to read localized values.

Order

interface Order {
  id: string;
  number: string;
  store_id: string;
  status: OrderStatus;
  workflow_status: OrderWorkflowStatus;
  items: OrderLineItem[];
  blocks: Block[];
  payment: Payment;
  shipping?: OrderShipping;
  shipments?: Shipment[];
  address?: Address;
  billing_address?: Address;
  audience_id?: string;
  created_at: number;
  updated_at: number;
}

type OrderStatus = 'active' | 'archived';

type OrderWorkflowStatus =
  | 'created'
  | 'pending'
  | 'authorized'
  | 'confirmed'
  | 'shipped'
  | 'completed'
  | 'cancelled'
  | 'failed';
Note

status is the active/archived split (used to hide an order from the default admin view). workflow_status carries the lifecycle state that used to live on status.

Order Line Item

type OrderLineItem = ProductLineItem | ServiceLineItem;

interface ProductLineItem {
  type: 'product';
  id: string;
  product_id: string;
  variant_id: string;
  name: string;
  sku?: string;
  price: number;
  quantity: number;
  image?: string;
}

interface ServiceLineItem {
  type: 'service';
  id: string;
  service_id: string;
  provider_id: string;
  slots: Array<{ from: number; to: number }>;
  snapshot?: {
    service_key?: string;
    provider_key?: string;
    price?: number;
  };
}

Payment

interface Payment {
  currency: string;
  market: string;
  subtotal: number;
  shipping: number;
  discount: number;
  total: number;
  paid: number;
  tax?: {
    amount: number;
    mode_snapshot?: string;
    rate_bps: number;
    lines: Array<{
      rate_bps: number;
      amount: number;
      label?: string;
      scope?: string;
    }>;
  };
  promo_code?: {
    id: string;
    code: string;
    type: string;
    value: number;
  };
  type: PaymentMethodType;
  provider?: {
    profile_id: string;
    payment_intent_id?: string;
    subscription_id?: string;
    price_id?: string;
  };
  refunds: PaymentRefund[];
  zone_id?: string;
  payment_method_id?: string;
  shipping_method_id?: string;
}

enum PaymentMethodType {
  Cash = 'cash',
  CreditCard = 'credit_card',
}

interface PaymentRefund {
  id: string;
  entity: string;
  total: number;
  provider_refund_id?: string;
  status: string;
  created_at: number;
}

Quote

interface Quote {
  market: string;
  zone: Zone | null;
  subtotal: number;
  shipping: number;
  discount: number;
  tax: number;
  total: number;
  shipping_method: ShippingMethod | null;
  payment_method: PaymentMethod | null;
  payment_methods: PaymentMethod[];
  promo_code: PromoCodeValidation | null;
  payment: Payment;
  charge_amount: number;
  id?: string;
  expires_at?: number;
}

interface PromoCodeValidation {
  promo_code_id: string;
  code: string;
  discounts: any[];
  conditions: any[];
}

Checkout Response

interface CheckoutResponse {
  order: Order;
  requires_action: boolean;
  client_secret?: string;  // For 3D Secure
  redirect_url?: string;
}

Promo Code

interface PromoCode {
  id: string;
  store_id: string;
  code: string;
  discounts: Discount[];
  conditions: Condition[];
  status: Status;        // 'active' | 'archived'
  created_at: number;
  updated_at: number;
}

interface Discount {
  type: 'items_percentage' | 'items_fixed' | 'shipping_percentage';
  market_id: string;
  bps?: number;
  amount?: number;
}

interface Condition {
  type:
    | 'products'
    | 'services'
    | 'min_order_amount'
    | 'date_range'
    | 'max_uses'
    | 'max_uses_per_user';
  value: string[] | number | { start?: number; end?: number };
}

Cart Item (Client-Side)

interface EshopCartItem {
  id: string;
  product_id: string;
  variant_id: string;
  product_name: string;
  product_slug: string;
  variant_attributes: Record<string, any>;
  price: Price;
  quantity: number;
  added_at: number;
}

Product Category

interface ProductCategory {
  slug: string;
  name: string;
  description?: string;
  image?: string;
  parent_slug?: string;
  product_count: number;
}

Inventory Event

interface InventoryEvent {
  product_id: string;
  type: 'INCREMENT' | 'DECREMENT' | 'SET';
  quantity: number;
  reason?: string;
  order_id?: string;
  timestamp: number;
}

Filter & Sort Options

interface ProductFilters {
  status?: Status;       // 'active' | 'archived'
  category?: string;
  min_price?: number;
  max_price?: number;
  in_stock?: boolean;
  search?: string;
}

interface ProductSort {
  field: 'created_at' | 'name' | 'price' | 'inventory';
  order: 'asc' | 'desc';
}