Skip to main content

Type Definitions

Type definitions for the Marketfront SDK.

MarketfrontConfig

Configuration object passed to the constructor.

interface MarketfrontConfig {
// Authentication (required)
sessionToken: string;

// Event callbacks
onReady?: () => void;
onError?: (error: MarketfrontError) => void;
onStoreSelected?: (store: StoreEvent) => void;
onItemAdded?: (item: ItemAddedEvent) => void;
onCheckoutStarted?: (checkout: CheckoutStartedEvent) => void;
onOrderComplete?: (order: Order) => void;
onOrderFailed?: (error: OrderFailedEvent) => void;
}
Configuration

Theme, UI options, payment settings, localization, fulfillment modes, and store filtering are configured via the Partner Dashboard. See the Feature Comparison for what's configurable.

Address

Delivery address structure.

interface Address {
address1: string;
address2?: string;
locality: string; // City
region: string; // State/province
postalCode: string;
country?: string; // ISO 3166-1 alpha-2
}

Order

Completed order data.

interface Order {
id: string;
storeId: string;
storeName: string;
total: number;
fulfillmentType: 'DeliveryByMerchant' | 'PickUp';
estimatedTime?: string;
items: Array<{
name: string;
quantity: number;
price: number;
}>;
}

Cart

Current cart state.

interface Cart {
itemCount: number;
subtotal: number;
items: Array<{
lineItemId: string;
name: string;
quantity: number;
price: number;
}>;
}

Import Types

Import all types for full IntelliSense:

import type {
MarketfrontClient,
MarketfrontConfig,
Address,
Order,
Cart,
Store,
MarketfrontError,
} from '@gett/marketfront';