Repository navigation
Models and Types
models/ holds the TypeScript definitions of the data that Selldone APIs return: shops, products, variants, categories, baskets, bills, customers, users, vendors, incentives, articles, community posts and more. All SDKs type their responses with these models, so learning them once helps everywhere. This page explains how the folder is organized, the class-plus-namespace pattern, the models you will use most, and the shared types in types/.
models/
├── account/ Account (wallet/accounting)
├── agency/ Agency, AgencyClient, AgencyPlan, AgencyWallet
├── application/ Application, ApplicationExecutorStorefront
├── article/ Article, ArticleReport
├── community/ Community, CommunityTopic, CommunityPost, CommunityComment, …
├── company/ Company
├── connect/ Connect, ConnectProvider
├── general/ Country, analytics models
├── guild/ Guild
├── notification/ NotificationRepository
├── user/ User, UserProfile
└── shop/
├── shop.model.ts Shop
├── product/ Product, ProductVariant, ProductImage, ProductFile, ProductContent, ProductRating, SubscriptionPrice, …
├── category/ Category
├── order/ Order, Basket, BasketItem, Bill, Avocado, Hyper, Fulfillment, …
├── customer/ Customer
├── vendor/ Vendor, VendorProduct, VendorPricing, VendorMember
├── incentives/ Coupon, Offer, Cashback, Lottery, GiftCard, GiftCardType, DiscountCode
├── payment/ ExchangeRate, GatewayQue
├── gateway/ Gateway, ShopGateway
├── logistic/, transportation/, shipping/ LogisticProfile, DeliveryService, Transportation
├── club/, campaign/, popup/, page/, blog/, design/, map/, domain/, …
└── cross-selling/, property-set/, review/, warehouse/ (import by path)
Everything under models/ is re-exported from the package root, except the four shop/ folders on the last line, which you import by file path (for example @selldone/core-js/models/shop/cross-selling/cross-sell.model).
import { Shop, Product, Category, Customer, User, Coupon } from "@selldone/core-js";
import type { Basket, BasketItem, ProductVariant, Order } from "@selldone/core-js";Most models are a class (or interface) and a namespace with the same name. The class describes the record; the namespace holds its enums, sub-types and constants.
import { Product } from "@selldone/core-js";
// Enums live in the namespace
Product.ProductType.SUBSCRIPTION; // "SUBSCRIPTION"
Product.ProductStatus.Open; // "Open"
Product.ProductCondition.USED_LIKE_NEW; // "used_like_new"
Product.ProductPricing.FIX; // "FIX"
Product.PriceInputType.AREA; // "area"
// Interfaces live in the namespace too
function title(p: Product.IProduct) {
return p.title;
}Fields are documented with the backend column or relation they come from, for example /** Product brand. Source: nullable shop_products.brand. */. API responses can be projections, so optional fields may be missing. In most code you use the models as types for plain JSON objects returned by the API; a few classes, such as Product and Category, also have a constructor that copies a plain object into a typed instance (Object.assign).
| Model | Import | Highlights |
|---|---|---|
Shop |
root | Shop configuration. Shop.Home enum: blog, avocado, hyper, community, shop, map, landing_page. Shop.ITheme, Shop.Info, Shop.ShopMarketplaceModes. |
Product |
root | Product record. Namespace enums: ProductType, ProductStatus, ProductCondition, ProductPricing, PriceInputType. |
ProductVariant |
root | Variant (color, style, volume, weight, pack, type) with its own price and quantity. |
Category |
root | Category tree node; Category.ICategory. |
Basket |
root (type) | Shopping cart / order. Basket.Status (Open, Reserved, Payed, Canceled, COD), Basket.ICalculatedBill. |
BasketItem |
root (type) | Item in a basket; BasketItem.IPreferences for service and dimension preferences. |
Order |
root (type) | Shared order types: Order.IAddress, Order.IReceiverInfo (address + pickup), Order.DeliveryStateCode, reject reasons. |
Customer |
root | Shop customer. Customer.Source: CUSTOMER ("customer"), VENDOR ("vendor"). |
User |
root | Selldone user account; UserProfile. |
Vendor, VendorProduct
|
root | Marketplace sellers and their offers. |
Coupon, Offer, Cashback, Lottery, GiftCard, DiscountCode
|
root | Incentive programs. |
ExchangeRate |
root | Currency exchange rate (from, to, rate), used by PriceHelper. |
Avocado, Hyper
|
root | Orders of the Avocado (request-based) and Hyper flows. |
Article |
root | Blog and product articles. |
CommunityPost, CommunityTopic, … |
root | Community data used by the Community SDK. |
import type { Product, Category } from "@selldone/core-js";
interface ProductListResponse {
products: Product.IProduct[];
folders: Category.ICategory[];
total?: number;
}import { Basket } from "@selldone/core-js";
if (basket.status === Basket.Status.Payed.code) {
// order is paid
}Basket.Status entries are objects with code, an i18n title key, a Material icon name, an image and a color, which makes it easy to render status chips.
| File | Type | Purpose |
|---|---|---|
types/route/return.type.ts |
IReturn |
Describes where to return after a flow: ROUTE_NAME, optional ROUTE_PARAMS, HIGHLIGHT_ID. |
types/upload/file-upload-response-type.type.ts |
IFileUploadResponse |
Upload response: url, path, name, size (bytes). |
types/assets.d.ts |
module declarations | Lets TypeScript import *.svg, *.png, *.jpg, *.gif and *.mp3 files as URL strings. |
import type { IFileUploadResponse } from "@selldone/core-js/types/upload/file-upload-response-type.type";global.d.ts also declares the globals Core relies on, such as window.$t, window.$language, window.selldone_config and window.$i18n_global.
- Enums: catalogs that complement the model namespaces.
- Helpers and Utilities: work with models (prices, URLs, baskets).
- Storefront SDK API Reference: which models each call returns.