@shopperlabs/shopper-types package provides comprehensive TypeScript type definitions for all Shopper models and entities. These types are useful when building storefronts, mobile apps, or any TypeScript application that interacts with the Shopper API.
Installation
Usage
Import types directly from the package:Available Types
The package exports types for all Shopper models:| Type | Description |
|---|---|
Product | Product model with variants, categories, and media |
ProductVariant | Product variant with pricing and attributes |
ProductTag | Simple label for cross-cutting product organization |
Order | Order with items, addresses, and shipping |
OrderItem | Individual order line item |
OrderShipping | Shipment with tracking and carrier |
OrderShippingEvent | Tracking event in a shipment timeline |
OrderAddress | Shipping or billing address on an order |
OrderRefund | Refund request for an order |
Customer | Customer profile and addresses |
Category | Hierarchical product category |
Brand | Product brand |
Collection | Product collection (manual or automatic) |
Attribute | Product attribute definition |
AttributeValue | Attribute value option |
Address | Customer address |
Channel | Sales channel |
Zone | Shipping/pricing zone |
Carrier | Shipping carrier |
CarrierOption | Carrier shipping option |
Currency | Currency configuration |
Discount | Discount/coupon code |
Inventory | Inventory location |
PaymentMethod | Payment method |
Review | Product review |
Supplier | Product supplier |
Enums
The package also exports enums for type-safe status checks:Available Enums
| Enum | Values |
|---|---|
ProductType | STANDARD, VARIANT, VIRTUAL, EXTERNAL |
OrderStatus | NEW, PROCESSING, COMPLETED, CANCELLED, ARCHIVED |
PaymentStatus | PENDING, AUTHORIZED, PAID, PARTIALLY_REFUNDED, REFUNDED, VOIDED |
ShippingStatus | UNFULFILLED, PARTIALLY_SHIPPED, SHIPPED, PARTIALLY_DELIVERED, DELIVERED, PARTIALLY_RETURNED, RETURNED |
FulfillmentStatus | PENDING, FORWARDED_TO_SUPPLIER, PROCESSING, SHIPPED, DELIVERED, CANCELLED |
ShipmentStatus | PENDING, PICKED_UP, IN_TRANSIT, AT_SORTING_CENTER, OUT_FOR_DELIVERY, DELIVERED, DELIVERY_FAILED, RETURNED |
OrderRefundStatus | PENDING, AWAITING, TREATMENT, PARTIAL_REFUND, REFUNDED, CANCELLED, REJECTED |
CollectionType | MANUAL, AUTO |
CollectionCondition | ALL, ANY |
CollectionRuleType | PRODUCT_TITLE, PRODUCT_BRAND, PRODUCT_CATEGORY, PRODUCT_PRICE, COMPARE_AT_PRICE, INVENTORY_STOCK, PRODUCT_CREATED_AT, PRODUCT_FEATURED, PRODUCT_RATING, PRODUCT_SALES_COUNT |
CollectionOperator | EQUALS_TO, NOT_EQUAL_TO, LESS_THAN, GREATER_THAN, STARTS_WITH, ENDS_WITH, CONTAINS, NOT_CONTAINS |
AddressType | BILLING, SHIPPING |
DiscountType | PERCENTAGE, FIXED_AMOUNT |
GenderType | MALE, FEMALE |
FieldType | TEXT, NUMBER, RICH_TEXT, SELECT, CHECKBOX, COLOR_PICKER, DATE_PICKER |
Weight | KG, G, LBS |
Length | M, CM, MM, FT, IN |
Volume | L, ML, GAL, FLOZ |
Common Interfaces
Entity
All models extend the baseEntity interface:
DateEntity
Dates are returned with both raw and human-readable formats:Price
Pricing information for products and variants:ShippingFields
Physical dimensions for shippable products:Example: Storefront Product List
Example: Order Details
Source Code
The types are open source and available on GitHub:GitHub Repository
View the source code and contribute to the types package.