@thorprovider/adapters 4.1.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix the published export map so bundlers do not resolve the `development` condition to an incomplete source graph. The package now resolves development/import/default entrypoints to built `dist` files, preventing Turbopack module-resolution failures in consumers.
8
+
9
+ ## 4.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 926be1f: Add mock-provider support across published packages and align the starter for mock-first storefront creation.
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [926be1f]
18
+ - @thorprovider/types@3.2.0
19
+
3
20
  ## 4.1.0
4
21
 
5
22
  ### Minor Changes
package/README.md CHANGED
@@ -1,3 +1,9 @@
1
+ ---
2
+ title: "@thorprovider/adapters"
3
+ purpose: "Explain the adapter package, its value proposition, and how to use the unified commerce provider layer"
4
+ lastReviewed: "2026-05-01"
5
+ ---
6
+
1
7
  # @thorprovider/adapters v2.0
2
8
 
3
9
  **Unified commerce adapters for Thor Commerce ecosystem**
@@ -125,7 +131,9 @@ Need e-commerce backend integration?
125
131
  ### Supported Providers
126
132
 
127
133
  Currently implemented:
134
+ - ✅ **Mock** — Fixture-backed provider for local development, previews, and backend-optional storefront bootstrapping
128
135
  - ✅ **Medusa JS** (v2) — Full implementation with multi-tenant support
136
+ - ✅ **Stel Order** — ERP adapter (v1): catalog, categories, inventory, customers, orders, payment/delivery listing. No cart/checkout/auth (single-company ERP).
129
137
 
130
138
  Planned (Phase 2–3):
131
139
  - 🟡 **Shopify** — In progress
@@ -137,7 +145,15 @@ Planned (Phase 2–3):
137
145
  ### Provider Selection
138
146
 
139
147
  ```typescript
140
- // Medusa backend (currently the only supported provider)
148
+ // Mock provider (safe default for preview / development)
149
+ const mockCommerce = createProvider({
150
+ provider: 'mock',
151
+ config: {
152
+ currencyCode: 'USD',
153
+ }
154
+ });
155
+
156
+ // Medusa backend
141
157
  const commerce = createProvider({
142
158
  provider: 'medusa',
143
159
  config: {
@@ -147,6 +163,17 @@ const commerce = createProvider({
147
163
  }
148
164
  });
149
165
 
166
+ // Stel Order ERP (catalog + CRM read/write, no cart/checkout)
167
+ const stelCommerce = createProvider({
168
+ provider: 'stelorder',
169
+ config: {
170
+ baseUrl: 'https://your-company.stelorder.com/app',
171
+ apiKey: process.env.STEL_ORDER_API_KEY,
172
+ currencyCode: 'EUR',
173
+ companyName: 'My Company',
174
+ }
175
+ });
176
+
150
177
  const products = await commerce.getProducts();
151
178
  ```
152
179
 
@@ -423,10 +450,11 @@ if (commerce.capabilities.updateEmail) {
423
450
  | Platform | Status | Documentation |
424
451
  |----------|--------|---------------|
425
452
  | **Medusa v2** | ✅ Production Ready | [Medusa Docs](https://docs.medusajs.com/) |
453
+ | **Stel Order** | ✅ ERP Adapter (v1) | Catalog, CRM, orders — no cart/checkout/auth |
426
454
  | **Shopify** | 🚧 Planned | [Shopify API](https://shopify.dev/api/storefront) |
427
455
  | **WooCommerce** | 🗓️ Roadmap | [WooCommerce API](https://woocommerce.github.io/woocommerce-rest-api-docs/) |
428
456
  | **BigCommerce** | 🗓️ Roadmap | [BigCommerce API](https://developer.bigcommerce.com/) |
429
- | **Local (Mock)** | 🗓️ Roadmap | For testing |
457
+ | **Local (Mock)** | ✅ Production Ready | For testing, previews, and backend-optional storefronts |
430
458
 
431
459
  **See**: [Providers Overview](./docs/providers-overview.md)
432
460
 
@@ -450,6 +478,11 @@ if (commerce.capabilities.updateEmail) {
450
478
  - [Add New Service](../../docs/workflows/legacy/add-adapter-service.md) - Service workflow
451
479
  - [Type Definitions](./src/types/) - Full TypeScript types
452
480
 
481
+ ### Testing
482
+ - Unit/integration tests: `yarn workspace @thorprovider/adapters test`
483
+ - Optional live Stel smoke test: `STEL_ORDER_SMOKE_TEST=1 STEL_ORDER_BASE_URL=... STEL_ORDER_API_KEY=... yarn workspace @thorprovider/adapters test:live`
484
+ - Live smoke stays read-only unless `STEL_ORDER_TEST_CUSTOMER_ID` is explicitly set
485
+
453
486
  ---
454
487
 
455
488
  ## Examples
@@ -569,6 +602,7 @@ const products = await commerce.getProducts();
569
602
  ├── types/ # Unified types (Product, Cart, etc.)
570
603
  ├── providers/ # Provider implementations
571
604
  │ ├── medusa/ # Medusa v2 provider
605
+ │ ├── stelorder/ # Stel Order ERP adapter
572
606
  │ └── shopify/ # (coming soon)
573
607
  ├── core/ # Core utilities (errors, logger)
574
608
  └── factory/ # Provider factory
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _thorprovider_types from '@thorprovider/types';
2
- import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry, ShippingMethod } from '@thorprovider/types';
2
+ import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry, ShippingMethod, Country } from '@thorprovider/types';
3
3
  export * from '@thorprovider/types';
4
4
  export { BackendCapabilities, CommerceProvider, DesignerConfig, DesignerHistoryEntry, DesignerNavItem, DesignerThemeConfig, DesignerThemePreset, ProviderConfig, StorefrontConfig, StorefrontConfigError, StorefrontContext, StorefrontPlatformType, StorefrontSeoDefaults } from '@thorprovider/types';
5
5
  import Medusa from '@medusajs/js-sdk';
@@ -225,12 +225,27 @@ interface UIPaymentMethod {
225
225
  * @see packages/core/docs/COMMERCE_PROVIDER_ARCHITECTURE.md
226
226
  */
227
227
 
228
+ /**
229
+ * Mock backend capabilities
230
+ *
231
+ * Fixture-backed provider used when a storefront has not yet been connected
232
+ * to a real backend. Supports the minimum commerce flows needed for layout,
233
+ * preview, navigation, region switching, and cart prototyping.
234
+ */
235
+ declare const MOCK_CAPABILITIES: Readonly<BackendCapabilities>;
228
236
  /**
229
237
  * Medusa backend capabilities
230
238
  *
231
239
  * @see https://docs.medusajs.com/api/store
232
240
  */
233
241
  declare const MEDUSA_CAPABILITIES: Readonly<BackendCapabilities>;
242
+ /**
243
+ * Stel Order backend capabilities
244
+ *
245
+ * ERP/document API with catalog, CRM, inventory visibility, and sales documents,
246
+ * but without cart, checkout, customer auth, or storefront-native payment flows.
247
+ */
248
+ declare const STELORDER_CAPABILITIES: Readonly<BackendCapabilities>;
234
249
  /**
235
250
  * Shopify backend capabilities
236
251
  *
@@ -2453,6 +2468,154 @@ declare class MagentoProvider implements CommerceProvider {
2453
2468
  isStorefrontRequired(): boolean;
2454
2469
  }
2455
2470
 
2471
+ interface StelOrderProviderConfig extends ProviderConfig {
2472
+ baseUrl: string;
2473
+ apiKey?: string;
2474
+ publishableKey?: string;
2475
+ currencyCode?: string;
2476
+ companyName?: string;
2477
+ storefrontId?: string;
2478
+ retry?: RetryConfig;
2479
+ }
2480
+
2481
+ declare class StelOrderProvider implements CommerceProvider {
2482
+ readonly name = "stelorder";
2483
+ readonly version = "1.0.0";
2484
+ readonly capabilities: BackendCapabilities;
2485
+ private readonly client;
2486
+ private readonly logger;
2487
+ private readonly currencyCode;
2488
+ private readonly storefrontId;
2489
+ private readonly companyName;
2490
+ constructor(config: StelOrderProviderConfig);
2491
+ getProduct(handle: string, _options?: {
2492
+ regionId?: string;
2493
+ }): Promise<Product | undefined>;
2494
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2495
+ getProductRecommendations(_productId: string): Promise<Product[]>;
2496
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2497
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2498
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2499
+ getCollection(handle: string): Promise<Collection | undefined>;
2500
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2501
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2502
+ getStockLocations(_params?: {
2503
+ salesChannelId?: string;
2504
+ }): Promise<StockLocation[]>;
2505
+ checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
2506
+ validateCartStock(_cartId: string): Promise<StockValidation>;
2507
+ getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2508
+ createCart(_options?: {
2509
+ regionId?: string;
2510
+ }): Promise<Cart>;
2511
+ getCart(_cartId: string): Promise<Cart | undefined>;
2512
+ addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
2513
+ removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
2514
+ updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
2515
+ completeCheckout(_cartId: string): Promise<Order>;
2516
+ getRegionCountries(_regionId: string): Promise<Country[]>;
2517
+ addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
2518
+ initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
2519
+ applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2520
+ removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2521
+ getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2522
+ getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
2523
+ getCustomer(customerId: string): Promise<Customer | undefined>;
2524
+ getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
2525
+ updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
2526
+ getOrder(orderId: string): Promise<Order | undefined>;
2527
+ getOrders(options: GetOrdersOptions): Promise<Order[]>;
2528
+ getAdminOrders(options?: {
2529
+ search?: string;
2530
+ status?: string | string[];
2531
+ limit?: number;
2532
+ offset?: number;
2533
+ }): Promise<{
2534
+ orders: Order[];
2535
+ count: number;
2536
+ }>;
2537
+ cancelOrder(_orderId: string): Promise<Order>;
2538
+ createFulfillment(_orderId: string, _items?: Array<{
2539
+ id: string;
2540
+ quantity: number;
2541
+ }>): Promise<void>;
2542
+ createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
2543
+ getStorefrontContext(): Promise<StorefrontContext>;
2544
+ isStorefrontRequired(): boolean;
2545
+ private notSupported;
2546
+ private wrapError;
2547
+ }
2548
+
2549
+ interface MockProviderConfig extends ProviderConfig {
2550
+ currencyCode?: string;
2551
+ siteUrl?: string;
2552
+ }
2553
+ declare class MockProvider implements CommerceProvider {
2554
+ readonly name = "mock";
2555
+ readonly version = "1.0.0";
2556
+ readonly capabilities: Readonly<_thorprovider_types.BackendCapabilities>;
2557
+ readonly isMock = true;
2558
+ private readonly currencyCode;
2559
+ private readonly siteUrl;
2560
+ constructor(config?: MockProviderConfig);
2561
+ private hasVariant;
2562
+ getProduct(handle: string, options?: {
2563
+ regionId?: string;
2564
+ }): Promise<Product | undefined>;
2565
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2566
+ getProductRecommendations(productId: string): Promise<Product[]>;
2567
+ getCollection(handle: string): Promise<Collection | undefined>;
2568
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2569
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2570
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2571
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2572
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2573
+ createCart(options?: {
2574
+ regionId?: string;
2575
+ }): Promise<Cart>;
2576
+ getCart(cartId: string): Promise<Cart | undefined>;
2577
+ addToCart(cartId: string, lines: CartLineInput[]): Promise<Cart>;
2578
+ removeFromCart(cartId: string, lineIds: string[]): Promise<Cart>;
2579
+ updateCart(cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
2580
+ getRegions(): Promise<Array<{
2581
+ id: string;
2582
+ name: string;
2583
+ currency_code: string;
2584
+ countries?: Array<{
2585
+ id: string;
2586
+ iso_2: string;
2587
+ name: string;
2588
+ display_name?: string;
2589
+ }>;
2590
+ }>>;
2591
+ completeCheckout(cartId: string): Promise<Order>;
2592
+ getShippingMethods(cartId: string): Promise<ShippingMethod[]>;
2593
+ getRegionCountries(regionId: string): Promise<_thorprovider_types.Country[]>;
2594
+ addShippingMethod(cartId: string, methodId: string): Promise<Cart>;
2595
+ initiatePaymentSession(cartId: string, providerId: string): Promise<void>;
2596
+ applyDiscountCode(cartId: string, code: string): Promise<Cart>;
2597
+ removeDiscountCode(cartId: string, _code: string): Promise<Cart>;
2598
+ getOrders(_options: GetOrdersOptions): Promise<Order[]>;
2599
+ getPaymentMethods(options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2600
+ getStockLocations(): Promise<StockLocation[]>;
2601
+ checkInventoryLevels(variantId: string): Promise<InventoryLevel[]>;
2602
+ validateCartStock(cartId: string): Promise<StockValidation>;
2603
+ getFulfillmentOptions(cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2604
+ cancelOrder(orderId: string): Promise<Order>;
2605
+ createFulfillment(_orderId: string, _items?: Array<{
2606
+ id: string;
2607
+ quantity: number;
2608
+ }>): Promise<void>;
2609
+ createRefund(orderId: string, _amount?: number, _reason?: string): Promise<void>;
2610
+ getAdminOrders(): Promise<{
2611
+ orders: Order[];
2612
+ count: number;
2613
+ }>;
2614
+ getAdminRegions(): Promise<Region[]>;
2615
+ getStorefrontContext(): Promise<StorefrontContext>;
2616
+ isStorefrontRequired(): boolean;
2617
+ }
2618
+
2456
2619
  /**
2457
2620
  * @thorprovider/adapters v2.0
2458
2621
  * Provider Factory - Create commerce providers dynamically
@@ -2474,8 +2637,14 @@ type ProviderType = ProviderTypeString;
2474
2637
  * Provider configuration discriminated union
2475
2638
  */
2476
2639
  type ProviderFactoryConfig = {
2640
+ provider: 'mock';
2641
+ config: MockProviderConfig;
2642
+ } | {
2477
2643
  provider: 'medusa';
2478
2644
  config: MedusaProviderConfig;
2645
+ } | {
2646
+ provider: 'stelorder';
2647
+ config: StelOrderProviderConfig;
2479
2648
  } | {
2480
2649
  provider: 'shopify';
2481
2650
  config: ShopifyProviderConfig;
@@ -2521,4 +2690,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
2521
2690
  */
2522
2691
  declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
2523
2692
 
2524
- export { AdminAuthService, type AdminSession, AdminSessionService, BIGCOMMERCE_CAPABILITIES, type BackendMapping, type BackendMetadataAdapter, type BackendMetadataAdapterConfig, BigCommerceProvider, type BigCommerceProviderConfig, CHANNEL_ASSIGNED_AT_KEY, CHANNEL_ASSIGNED_BY_KEY, CHANNEL_SCOPE_KEY, type ChannelScopeMetadata, ChannelScopeValidationError, type ChannelScopeable, CircuitBreaker, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitBreakerStats, type CircuitState, CommerceError, ConfigurationError, type Coordinates, type FulfillmentGroup, type FulfillmentPlan, type LogLevel, type Logger, MAGENTO_CAPABILITIES, MEDUSA_CAPABILITIES, MagentoProvider, type MagentoProviderConfig, MedusaMetadataAdapter, MedusaProvider, type MedusaProviderConfig, type MetricsOrderInput, type MetricsProductInput, MetricsService, type PlanFulfillmentShippingAddress, ProviderAPIError, type ProviderFactoryConfig, ProviderNotFoundError, type ProviderType, ResourceNotFoundError, SHOPIFY_CAPABILITIES, SPREE_CAPABILITIES, ShopifyProvider, type ShopifyProviderConfig, SpreeProvider, type SpreeProviderConfig, type UICartItem, type UICartTotals, type UIDiscountCode, type UIPaymentMethod, type UIShippingMethod, WOOCOMMERCE_CAPABILITIES, WooCommerceProvider, type WooCommerceProviderConfig, assertEntityBelongsToChannel, backendCircuitBreaker, buildChannelScopeMetadata, calculateDistance, createBackendMetadataAdapter, createLogger, createProvider, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };
2693
+ export { AdminAuthService, type AdminSession, AdminSessionService, BIGCOMMERCE_CAPABILITIES, type BackendMapping, type BackendMetadataAdapter, type BackendMetadataAdapterConfig, BigCommerceProvider, type BigCommerceProviderConfig, CHANNEL_ASSIGNED_AT_KEY, CHANNEL_ASSIGNED_BY_KEY, CHANNEL_SCOPE_KEY, type ChannelScopeMetadata, ChannelScopeValidationError, type ChannelScopeable, CircuitBreaker, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitBreakerStats, type CircuitState, CommerceError, ConfigurationError, type Coordinates, type FulfillmentGroup, type FulfillmentPlan, type LogLevel, type Logger, MAGENTO_CAPABILITIES, MEDUSA_CAPABILITIES, MOCK_CAPABILITIES, MagentoProvider, type MagentoProviderConfig, MedusaMetadataAdapter, MedusaProvider, type MedusaProviderConfig, type MetricsOrderInput, type MetricsProductInput, MetricsService, MockProvider, type MockProviderConfig, type PlanFulfillmentShippingAddress, ProviderAPIError, type ProviderFactoryConfig, ProviderNotFoundError, type ProviderType, ResourceNotFoundError, SHOPIFY_CAPABILITIES, SPREE_CAPABILITIES, STELORDER_CAPABILITIES, ShopifyProvider, type ShopifyProviderConfig, SpreeProvider, type SpreeProviderConfig, StelOrderProvider, type StelOrderProviderConfig, type UICartItem, type UICartTotals, type UIDiscountCode, type UIPaymentMethod, type UIShippingMethod, WOOCOMMERCE_CAPABILITIES, WooCommerceProvider, type WooCommerceProviderConfig, assertEntityBelongsToChannel, backendCircuitBreaker, buildChannelScopeMetadata, calculateDistance, createBackendMetadataAdapter, createLogger, createProvider, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _thorprovider_types from '@thorprovider/types';
2
- import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry, ShippingMethod } from '@thorprovider/types';
2
+ import { BackendCapabilities, Money, PaymentMethod, FulfillmentOption, CartItem, StockLocation, InventoryLevel, StorefrontConfig, DashboardMetrics, ProviderTypeString, CommerceProvider, AuthProvider, ProviderConfig, AuthConfig, Product, GetProductsOptions, AdvancedSearchProductsOptions, SearchResultMeta, FilterConfig, Collection, GetCollectionsOptions, CollectionProductsOptions, ProductCategory, GetCategoriesOptions, Cart, CartLineInput, CartLineUpdate, GetOrdersOptions, Order, GetCustomersOptions, Customer, Address, Region, AdminProduct, PaymentMethodsOptions, StockValidation, StorefrontContext, DesignerConfig, DesignerHistoryEntry, ShippingMethod, Country } from '@thorprovider/types';
3
3
  export * from '@thorprovider/types';
4
4
  export { BackendCapabilities, CommerceProvider, DesignerConfig, DesignerHistoryEntry, DesignerNavItem, DesignerThemeConfig, DesignerThemePreset, ProviderConfig, StorefrontConfig, StorefrontConfigError, StorefrontContext, StorefrontPlatformType, StorefrontSeoDefaults } from '@thorprovider/types';
5
5
  import Medusa from '@medusajs/js-sdk';
@@ -225,12 +225,27 @@ interface UIPaymentMethod {
225
225
  * @see packages/core/docs/COMMERCE_PROVIDER_ARCHITECTURE.md
226
226
  */
227
227
 
228
+ /**
229
+ * Mock backend capabilities
230
+ *
231
+ * Fixture-backed provider used when a storefront has not yet been connected
232
+ * to a real backend. Supports the minimum commerce flows needed for layout,
233
+ * preview, navigation, region switching, and cart prototyping.
234
+ */
235
+ declare const MOCK_CAPABILITIES: Readonly<BackendCapabilities>;
228
236
  /**
229
237
  * Medusa backend capabilities
230
238
  *
231
239
  * @see https://docs.medusajs.com/api/store
232
240
  */
233
241
  declare const MEDUSA_CAPABILITIES: Readonly<BackendCapabilities>;
242
+ /**
243
+ * Stel Order backend capabilities
244
+ *
245
+ * ERP/document API with catalog, CRM, inventory visibility, and sales documents,
246
+ * but without cart, checkout, customer auth, or storefront-native payment flows.
247
+ */
248
+ declare const STELORDER_CAPABILITIES: Readonly<BackendCapabilities>;
234
249
  /**
235
250
  * Shopify backend capabilities
236
251
  *
@@ -2453,6 +2468,154 @@ declare class MagentoProvider implements CommerceProvider {
2453
2468
  isStorefrontRequired(): boolean;
2454
2469
  }
2455
2470
 
2471
+ interface StelOrderProviderConfig extends ProviderConfig {
2472
+ baseUrl: string;
2473
+ apiKey?: string;
2474
+ publishableKey?: string;
2475
+ currencyCode?: string;
2476
+ companyName?: string;
2477
+ storefrontId?: string;
2478
+ retry?: RetryConfig;
2479
+ }
2480
+
2481
+ declare class StelOrderProvider implements CommerceProvider {
2482
+ readonly name = "stelorder";
2483
+ readonly version = "1.0.0";
2484
+ readonly capabilities: BackendCapabilities;
2485
+ private readonly client;
2486
+ private readonly logger;
2487
+ private readonly currencyCode;
2488
+ private readonly storefrontId;
2489
+ private readonly companyName;
2490
+ constructor(config: StelOrderProviderConfig);
2491
+ getProduct(handle: string, _options?: {
2492
+ regionId?: string;
2493
+ }): Promise<Product | undefined>;
2494
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2495
+ getProductRecommendations(_productId: string): Promise<Product[]>;
2496
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2497
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2498
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2499
+ getCollection(handle: string): Promise<Collection | undefined>;
2500
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2501
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2502
+ getStockLocations(_params?: {
2503
+ salesChannelId?: string;
2504
+ }): Promise<StockLocation[]>;
2505
+ checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
2506
+ validateCartStock(_cartId: string): Promise<StockValidation>;
2507
+ getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2508
+ createCart(_options?: {
2509
+ regionId?: string;
2510
+ }): Promise<Cart>;
2511
+ getCart(_cartId: string): Promise<Cart | undefined>;
2512
+ addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
2513
+ removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
2514
+ updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
2515
+ completeCheckout(_cartId: string): Promise<Order>;
2516
+ getRegionCountries(_regionId: string): Promise<Country[]>;
2517
+ addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
2518
+ initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
2519
+ applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2520
+ removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2521
+ getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2522
+ getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
2523
+ getCustomer(customerId: string): Promise<Customer | undefined>;
2524
+ getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
2525
+ updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
2526
+ getOrder(orderId: string): Promise<Order | undefined>;
2527
+ getOrders(options: GetOrdersOptions): Promise<Order[]>;
2528
+ getAdminOrders(options?: {
2529
+ search?: string;
2530
+ status?: string | string[];
2531
+ limit?: number;
2532
+ offset?: number;
2533
+ }): Promise<{
2534
+ orders: Order[];
2535
+ count: number;
2536
+ }>;
2537
+ cancelOrder(_orderId: string): Promise<Order>;
2538
+ createFulfillment(_orderId: string, _items?: Array<{
2539
+ id: string;
2540
+ quantity: number;
2541
+ }>): Promise<void>;
2542
+ createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
2543
+ getStorefrontContext(): Promise<StorefrontContext>;
2544
+ isStorefrontRequired(): boolean;
2545
+ private notSupported;
2546
+ private wrapError;
2547
+ }
2548
+
2549
+ interface MockProviderConfig extends ProviderConfig {
2550
+ currencyCode?: string;
2551
+ siteUrl?: string;
2552
+ }
2553
+ declare class MockProvider implements CommerceProvider {
2554
+ readonly name = "mock";
2555
+ readonly version = "1.0.0";
2556
+ readonly capabilities: Readonly<_thorprovider_types.BackendCapabilities>;
2557
+ readonly isMock = true;
2558
+ private readonly currencyCode;
2559
+ private readonly siteUrl;
2560
+ constructor(config?: MockProviderConfig);
2561
+ private hasVariant;
2562
+ getProduct(handle: string, options?: {
2563
+ regionId?: string;
2564
+ }): Promise<Product | undefined>;
2565
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2566
+ getProductRecommendations(productId: string): Promise<Product[]>;
2567
+ getCollection(handle: string): Promise<Collection | undefined>;
2568
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2569
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2570
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2571
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2572
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2573
+ createCart(options?: {
2574
+ regionId?: string;
2575
+ }): Promise<Cart>;
2576
+ getCart(cartId: string): Promise<Cart | undefined>;
2577
+ addToCart(cartId: string, lines: CartLineInput[]): Promise<Cart>;
2578
+ removeFromCart(cartId: string, lineIds: string[]): Promise<Cart>;
2579
+ updateCart(cartId: string, lines: CartLineUpdate[]): Promise<Cart>;
2580
+ getRegions(): Promise<Array<{
2581
+ id: string;
2582
+ name: string;
2583
+ currency_code: string;
2584
+ countries?: Array<{
2585
+ id: string;
2586
+ iso_2: string;
2587
+ name: string;
2588
+ display_name?: string;
2589
+ }>;
2590
+ }>>;
2591
+ completeCheckout(cartId: string): Promise<Order>;
2592
+ getShippingMethods(cartId: string): Promise<ShippingMethod[]>;
2593
+ getRegionCountries(regionId: string): Promise<_thorprovider_types.Country[]>;
2594
+ addShippingMethod(cartId: string, methodId: string): Promise<Cart>;
2595
+ initiatePaymentSession(cartId: string, providerId: string): Promise<void>;
2596
+ applyDiscountCode(cartId: string, code: string): Promise<Cart>;
2597
+ removeDiscountCode(cartId: string, _code: string): Promise<Cart>;
2598
+ getOrders(_options: GetOrdersOptions): Promise<Order[]>;
2599
+ getPaymentMethods(options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2600
+ getStockLocations(): Promise<StockLocation[]>;
2601
+ checkInventoryLevels(variantId: string): Promise<InventoryLevel[]>;
2602
+ validateCartStock(cartId: string): Promise<StockValidation>;
2603
+ getFulfillmentOptions(cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2604
+ cancelOrder(orderId: string): Promise<Order>;
2605
+ createFulfillment(_orderId: string, _items?: Array<{
2606
+ id: string;
2607
+ quantity: number;
2608
+ }>): Promise<void>;
2609
+ createRefund(orderId: string, _amount?: number, _reason?: string): Promise<void>;
2610
+ getAdminOrders(): Promise<{
2611
+ orders: Order[];
2612
+ count: number;
2613
+ }>;
2614
+ getAdminRegions(): Promise<Region[]>;
2615
+ getStorefrontContext(): Promise<StorefrontContext>;
2616
+ isStorefrontRequired(): boolean;
2617
+ }
2618
+
2456
2619
  /**
2457
2620
  * @thorprovider/adapters v2.0
2458
2621
  * Provider Factory - Create commerce providers dynamically
@@ -2474,8 +2637,14 @@ type ProviderType = ProviderTypeString;
2474
2637
  * Provider configuration discriminated union
2475
2638
  */
2476
2639
  type ProviderFactoryConfig = {
2640
+ provider: 'mock';
2641
+ config: MockProviderConfig;
2642
+ } | {
2477
2643
  provider: 'medusa';
2478
2644
  config: MedusaProviderConfig;
2645
+ } | {
2646
+ provider: 'stelorder';
2647
+ config: StelOrderProviderConfig;
2479
2648
  } | {
2480
2649
  provider: 'shopify';
2481
2650
  config: ShopifyProviderConfig;
@@ -2521,4 +2690,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
2521
2690
  */
2522
2691
  declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
2523
2692
 
2524
- export { AdminAuthService, type AdminSession, AdminSessionService, BIGCOMMERCE_CAPABILITIES, type BackendMapping, type BackendMetadataAdapter, type BackendMetadataAdapterConfig, BigCommerceProvider, type BigCommerceProviderConfig, CHANNEL_ASSIGNED_AT_KEY, CHANNEL_ASSIGNED_BY_KEY, CHANNEL_SCOPE_KEY, type ChannelScopeMetadata, ChannelScopeValidationError, type ChannelScopeable, CircuitBreaker, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitBreakerStats, type CircuitState, CommerceError, ConfigurationError, type Coordinates, type FulfillmentGroup, type FulfillmentPlan, type LogLevel, type Logger, MAGENTO_CAPABILITIES, MEDUSA_CAPABILITIES, MagentoProvider, type MagentoProviderConfig, MedusaMetadataAdapter, MedusaProvider, type MedusaProviderConfig, type MetricsOrderInput, type MetricsProductInput, MetricsService, type PlanFulfillmentShippingAddress, ProviderAPIError, type ProviderFactoryConfig, ProviderNotFoundError, type ProviderType, ResourceNotFoundError, SHOPIFY_CAPABILITIES, SPREE_CAPABILITIES, ShopifyProvider, type ShopifyProviderConfig, SpreeProvider, type SpreeProviderConfig, type UICartItem, type UICartTotals, type UIDiscountCode, type UIPaymentMethod, type UIShippingMethod, WOOCOMMERCE_CAPABILITIES, WooCommerceProvider, type WooCommerceProviderConfig, assertEntityBelongsToChannel, backendCircuitBreaker, buildChannelScopeMetadata, calculateDistance, createBackendMetadataAdapter, createLogger, createProvider, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };
2693
+ export { AdminAuthService, type AdminSession, AdminSessionService, BIGCOMMERCE_CAPABILITIES, type BackendMapping, type BackendMetadataAdapter, type BackendMetadataAdapterConfig, BigCommerceProvider, type BigCommerceProviderConfig, CHANNEL_ASSIGNED_AT_KEY, CHANNEL_ASSIGNED_BY_KEY, CHANNEL_SCOPE_KEY, type ChannelScopeMetadata, ChannelScopeValidationError, type ChannelScopeable, CircuitBreaker, type CircuitBreakerConfig, CircuitBreakerOpenError, type CircuitBreakerStats, type CircuitState, CommerceError, ConfigurationError, type Coordinates, type FulfillmentGroup, type FulfillmentPlan, type LogLevel, type Logger, MAGENTO_CAPABILITIES, MEDUSA_CAPABILITIES, MOCK_CAPABILITIES, MagentoProvider, type MagentoProviderConfig, MedusaMetadataAdapter, MedusaProvider, type MedusaProviderConfig, type MetricsOrderInput, type MetricsProductInput, MetricsService, MockProvider, type MockProviderConfig, type PlanFulfillmentShippingAddress, ProviderAPIError, type ProviderFactoryConfig, ProviderNotFoundError, type ProviderType, ResourceNotFoundError, SHOPIFY_CAPABILITIES, SPREE_CAPABILITIES, STELORDER_CAPABILITIES, ShopifyProvider, type ShopifyProviderConfig, SpreeProvider, type SpreeProviderConfig, StelOrderProvider, type StelOrderProviderConfig, type UICartItem, type UICartTotals, type UIDiscountCode, type UIPaymentMethod, type UIShippingMethod, WOOCOMMERCE_CAPABILITIES, WooCommerceProvider, type WooCommerceProviderConfig, assertEntityBelongsToChannel, backendCircuitBreaker, buildChannelScopeMetadata, calculateDistance, createBackendMetadataAdapter, createLogger, createProvider, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };