@thorprovider/adapters 4.2.0 → 4.2.2

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.
Files changed (48) hide show
  1. package/.turbo/turbo-build.log +18 -18
  2. package/.turbo/turbo-test.log +1 -0
  3. package/.turbo/turbo-type-check.log +0 -0
  4. package/AGENTS.md +1 -1
  5. package/CHANGELOG.md +12 -0
  6. package/PROVIDER_IMPLEMENTATION_ANALYSIS.md +659 -0
  7. package/README.md +22 -3
  8. package/dist/.tsbuildinfo +1 -1
  9. package/dist/index.d.mts +140 -2
  10. package/dist/index.d.ts +140 -2
  11. package/dist/index.js +1075 -0
  12. package/dist/index.js.map +1 -1
  13. package/dist/index.mjs +1070 -0
  14. package/dist/index.mjs.map +1 -1
  15. package/docs/RETRY_SOLUTION_SUMMARY.md +26 -11
  16. package/docs/authentication.md +89 -62
  17. package/docs/capabilities-system.md +100 -38
  18. package/docs/category-customization.md +37 -29
  19. package/docs/fetch-reliability-solution.md +127 -278
  20. package/docs/getting-started.md +43 -29
  21. package/docs/profile-management.md +68 -38
  22. package/docs/providers-overview.md +14 -0
  23. package/docs/services-overview.md +20 -2
  24. package/docs/update-documentation.md +10 -8
  25. package/package.json +11 -6
  26. package/publish.log +93 -0
  27. package/quick-reference.md +1 -0
  28. package/src/factory/index.ts +4 -0
  29. package/src/index.ts +7 -0
  30. package/src/providers/index.ts +3 -0
  31. package/src/providers/medusa/admin.test.ts +404 -0
  32. package/src/providers/medusa/admin.ts +442 -0
  33. package/src/providers/medusa/auth.test.ts +95 -0
  34. package/src/providers/medusa/index.test.ts +392 -0
  35. package/src/providers/medusa/live-smoke.test.ts +412 -0
  36. package/src/providers/stelorder/client.test-helpers.ts +3 -0
  37. package/src/providers/stelorder/client.test.ts +58 -0
  38. package/src/providers/stelorder/client.ts +326 -0
  39. package/src/providers/stelorder/index.test.ts +48 -0
  40. package/src/providers/stelorder/index.ts +685 -0
  41. package/src/providers/stelorder/live-smoke.test.ts +54 -0
  42. package/src/providers/stelorder/transforms.test.ts +103 -0
  43. package/src/providers/stelorder/transforms.ts +631 -0
  44. package/src/resilience/README.md +70 -48
  45. package/src/types/capabilities.types.ts +51 -0
  46. package/vitest.config.ts +13 -0
  47. package/vitest.live.config.ts +18 -0
  48. package/vitest.setup.ts +6 -0
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';
@@ -239,6 +239,13 @@ declare const MOCK_CAPABILITIES: Readonly<BackendCapabilities>;
239
239
  * @see https://docs.medusajs.com/api/store
240
240
  */
241
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>;
242
249
  /**
243
250
  * Shopify backend capabilities
244
251
  *
@@ -315,6 +322,11 @@ declare class ProviderAPIError extends CommerceError {
315
322
  readonly provider: string;
316
323
  constructor(message: string, provider: string, status?: number);
317
324
  }
325
+ /**
326
+ * Extract error message from various error types
327
+ * Handles standard Error objects, API responses, and unknown error types
328
+ */
329
+ declare function extractErrorMessage(error: unknown): string;
318
330
 
319
331
  /**
320
332
  * @thorprovider/adapters v2.0
@@ -370,6 +382,51 @@ interface RetryConfig {
370
382
  */
371
383
  retryableStatusCodes?: number[];
372
384
  }
385
+ /**
386
+ * Enhanced fetch with retry logic and timeout
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * import { fetchWithRetry } from '@thorprovider/adapters/core/fetch-utils';
391
+ *
392
+ * // Basic usage with defaults (3 retries, 10s timeout)
393
+ * const response = await fetchWithRetry('https://api.example.com/products');
394
+ *
395
+ * // Custom configuration
396
+ * const response = await fetchWithRetry(
397
+ * 'https://api.example.com/products',
398
+ * {
399
+ * method: 'POST',
400
+ * body: JSON.stringify({ name: 'Product' }),
401
+ * },
402
+ * {
403
+ * maxRetries: 5,
404
+ * timeoutMs: 15000, // 15 seconds
405
+ * initialDelayMs: 500,
406
+ * }
407
+ * );
408
+ * ```
409
+ */
410
+ declare function fetchWithRetry(url: string, init?: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
411
+ /**
412
+ * Create a fetch function with custom retry configuration
413
+ * Useful for creating a configured fetch instance
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * import { createFetchWithRetry } from '@thorprovider/adapters/core/fetch-utils';
418
+ *
419
+ * // Create configured fetch
420
+ * const customFetch = createFetchWithRetry({
421
+ * maxRetries: 5,
422
+ * timeoutMs: 15000,
423
+ * });
424
+ *
425
+ * // Use it like regular fetch
426
+ * const response = await customFetch('https://api.example.com/products');
427
+ * ```
428
+ */
429
+ declare function createFetchWithRetry(retryConfig?: RetryConfig): (url: string, init?: RequestInit) => Promise<Response>;
373
430
 
374
431
  /**
375
432
  * Circuit Breaker Pattern Implementation
@@ -2461,6 +2518,84 @@ declare class MagentoProvider implements CommerceProvider {
2461
2518
  isStorefrontRequired(): boolean;
2462
2519
  }
2463
2520
 
2521
+ interface StelOrderProviderConfig extends ProviderConfig {
2522
+ baseUrl: string;
2523
+ apiKey?: string;
2524
+ publishableKey?: string;
2525
+ currencyCode?: string;
2526
+ companyName?: string;
2527
+ storefrontId?: string;
2528
+ retry?: RetryConfig;
2529
+ }
2530
+
2531
+ declare class StelOrderProvider implements CommerceProvider {
2532
+ readonly name = "stelorder";
2533
+ readonly version = "1.0.0";
2534
+ readonly capabilities: BackendCapabilities;
2535
+ private readonly client;
2536
+ private readonly logger;
2537
+ private readonly currencyCode;
2538
+ private readonly storefrontId;
2539
+ private readonly companyName;
2540
+ constructor(config: StelOrderProviderConfig);
2541
+ getProduct(handle: string, _options?: {
2542
+ regionId?: string;
2543
+ }): Promise<Product | undefined>;
2544
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2545
+ getProductRecommendations(_productId: string): Promise<Product[]>;
2546
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2547
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2548
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2549
+ getCollection(handle: string): Promise<Collection | undefined>;
2550
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2551
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2552
+ getStockLocations(_params?: {
2553
+ salesChannelId?: string;
2554
+ }): Promise<StockLocation[]>;
2555
+ checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
2556
+ validateCartStock(_cartId: string): Promise<StockValidation>;
2557
+ getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2558
+ createCart(_options?: {
2559
+ regionId?: string;
2560
+ }): Promise<Cart>;
2561
+ getCart(_cartId: string): Promise<Cart | undefined>;
2562
+ addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
2563
+ removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
2564
+ updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
2565
+ completeCheckout(_cartId: string): Promise<Order>;
2566
+ getRegionCountries(_regionId: string): Promise<Country[]>;
2567
+ addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
2568
+ initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
2569
+ applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2570
+ removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2571
+ getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2572
+ getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
2573
+ getCustomer(customerId: string): Promise<Customer | undefined>;
2574
+ getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
2575
+ updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
2576
+ getOrder(orderId: string): Promise<Order | undefined>;
2577
+ getOrders(options: GetOrdersOptions): Promise<Order[]>;
2578
+ getAdminOrders(options?: {
2579
+ search?: string;
2580
+ status?: string | string[];
2581
+ limit?: number;
2582
+ offset?: number;
2583
+ }): Promise<{
2584
+ orders: Order[];
2585
+ count: number;
2586
+ }>;
2587
+ cancelOrder(_orderId: string): Promise<Order>;
2588
+ createFulfillment(_orderId: string, _items?: Array<{
2589
+ id: string;
2590
+ quantity: number;
2591
+ }>): Promise<void>;
2592
+ createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
2593
+ getStorefrontContext(): Promise<StorefrontContext>;
2594
+ isStorefrontRequired(): boolean;
2595
+ private notSupported;
2596
+ private wrapError;
2597
+ }
2598
+
2464
2599
  interface MockProviderConfig extends ProviderConfig {
2465
2600
  currencyCode?: string;
2466
2601
  siteUrl?: string;
@@ -2557,6 +2692,9 @@ type ProviderFactoryConfig = {
2557
2692
  } | {
2558
2693
  provider: 'medusa';
2559
2694
  config: MedusaProviderConfig;
2695
+ } | {
2696
+ provider: 'stelorder';
2697
+ config: StelOrderProviderConfig;
2560
2698
  } | {
2561
2699
  provider: 'shopify';
2562
2700
  config: ShopifyProviderConfig;
@@ -2602,4 +2740,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
2602
2740
  */
2603
2741
  declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
2604
2742
 
2605
- 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, 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 };
2743
+ 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, type RetryConfig, 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, createFetchWithRetry, createLogger, createProvider, extractErrorMessage, fetchWithRetry, 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';
@@ -239,6 +239,13 @@ declare const MOCK_CAPABILITIES: Readonly<BackendCapabilities>;
239
239
  * @see https://docs.medusajs.com/api/store
240
240
  */
241
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>;
242
249
  /**
243
250
  * Shopify backend capabilities
244
251
  *
@@ -315,6 +322,11 @@ declare class ProviderAPIError extends CommerceError {
315
322
  readonly provider: string;
316
323
  constructor(message: string, provider: string, status?: number);
317
324
  }
325
+ /**
326
+ * Extract error message from various error types
327
+ * Handles standard Error objects, API responses, and unknown error types
328
+ */
329
+ declare function extractErrorMessage(error: unknown): string;
318
330
 
319
331
  /**
320
332
  * @thorprovider/adapters v2.0
@@ -370,6 +382,51 @@ interface RetryConfig {
370
382
  */
371
383
  retryableStatusCodes?: number[];
372
384
  }
385
+ /**
386
+ * Enhanced fetch with retry logic and timeout
387
+ *
388
+ * @example
389
+ * ```typescript
390
+ * import { fetchWithRetry } from '@thorprovider/adapters/core/fetch-utils';
391
+ *
392
+ * // Basic usage with defaults (3 retries, 10s timeout)
393
+ * const response = await fetchWithRetry('https://api.example.com/products');
394
+ *
395
+ * // Custom configuration
396
+ * const response = await fetchWithRetry(
397
+ * 'https://api.example.com/products',
398
+ * {
399
+ * method: 'POST',
400
+ * body: JSON.stringify({ name: 'Product' }),
401
+ * },
402
+ * {
403
+ * maxRetries: 5,
404
+ * timeoutMs: 15000, // 15 seconds
405
+ * initialDelayMs: 500,
406
+ * }
407
+ * );
408
+ * ```
409
+ */
410
+ declare function fetchWithRetry(url: string, init?: RequestInit, retryConfig?: RetryConfig): Promise<Response>;
411
+ /**
412
+ * Create a fetch function with custom retry configuration
413
+ * Useful for creating a configured fetch instance
414
+ *
415
+ * @example
416
+ * ```typescript
417
+ * import { createFetchWithRetry } from '@thorprovider/adapters/core/fetch-utils';
418
+ *
419
+ * // Create configured fetch
420
+ * const customFetch = createFetchWithRetry({
421
+ * maxRetries: 5,
422
+ * timeoutMs: 15000,
423
+ * });
424
+ *
425
+ * // Use it like regular fetch
426
+ * const response = await customFetch('https://api.example.com/products');
427
+ * ```
428
+ */
429
+ declare function createFetchWithRetry(retryConfig?: RetryConfig): (url: string, init?: RequestInit) => Promise<Response>;
373
430
 
374
431
  /**
375
432
  * Circuit Breaker Pattern Implementation
@@ -2461,6 +2518,84 @@ declare class MagentoProvider implements CommerceProvider {
2461
2518
  isStorefrontRequired(): boolean;
2462
2519
  }
2463
2520
 
2521
+ interface StelOrderProviderConfig extends ProviderConfig {
2522
+ baseUrl: string;
2523
+ apiKey?: string;
2524
+ publishableKey?: string;
2525
+ currencyCode?: string;
2526
+ companyName?: string;
2527
+ storefrontId?: string;
2528
+ retry?: RetryConfig;
2529
+ }
2530
+
2531
+ declare class StelOrderProvider implements CommerceProvider {
2532
+ readonly name = "stelorder";
2533
+ readonly version = "1.0.0";
2534
+ readonly capabilities: BackendCapabilities;
2535
+ private readonly client;
2536
+ private readonly logger;
2537
+ private readonly currencyCode;
2538
+ private readonly storefrontId;
2539
+ private readonly companyName;
2540
+ constructor(config: StelOrderProviderConfig);
2541
+ getProduct(handle: string, _options?: {
2542
+ regionId?: string;
2543
+ }): Promise<Product | undefined>;
2544
+ getProducts(options?: GetProductsOptions): Promise<Product[]>;
2545
+ getProductRecommendations(_productId: string): Promise<Product[]>;
2546
+ getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
2547
+ getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
2548
+ getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2549
+ getCollection(handle: string): Promise<Collection | undefined>;
2550
+ getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
2551
+ getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
2552
+ getStockLocations(_params?: {
2553
+ salesChannelId?: string;
2554
+ }): Promise<StockLocation[]>;
2555
+ checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
2556
+ validateCartStock(_cartId: string): Promise<StockValidation>;
2557
+ getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
2558
+ createCart(_options?: {
2559
+ regionId?: string;
2560
+ }): Promise<Cart>;
2561
+ getCart(_cartId: string): Promise<Cart | undefined>;
2562
+ addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
2563
+ removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
2564
+ updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
2565
+ completeCheckout(_cartId: string): Promise<Order>;
2566
+ getRegionCountries(_regionId: string): Promise<Country[]>;
2567
+ addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
2568
+ initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
2569
+ applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2570
+ removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
2571
+ getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
2572
+ getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
2573
+ getCustomer(customerId: string): Promise<Customer | undefined>;
2574
+ getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
2575
+ updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
2576
+ getOrder(orderId: string): Promise<Order | undefined>;
2577
+ getOrders(options: GetOrdersOptions): Promise<Order[]>;
2578
+ getAdminOrders(options?: {
2579
+ search?: string;
2580
+ status?: string | string[];
2581
+ limit?: number;
2582
+ offset?: number;
2583
+ }): Promise<{
2584
+ orders: Order[];
2585
+ count: number;
2586
+ }>;
2587
+ cancelOrder(_orderId: string): Promise<Order>;
2588
+ createFulfillment(_orderId: string, _items?: Array<{
2589
+ id: string;
2590
+ quantity: number;
2591
+ }>): Promise<void>;
2592
+ createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
2593
+ getStorefrontContext(): Promise<StorefrontContext>;
2594
+ isStorefrontRequired(): boolean;
2595
+ private notSupported;
2596
+ private wrapError;
2597
+ }
2598
+
2464
2599
  interface MockProviderConfig extends ProviderConfig {
2465
2600
  currencyCode?: string;
2466
2601
  siteUrl?: string;
@@ -2557,6 +2692,9 @@ type ProviderFactoryConfig = {
2557
2692
  } | {
2558
2693
  provider: 'medusa';
2559
2694
  config: MedusaProviderConfig;
2695
+ } | {
2696
+ provider: 'stelorder';
2697
+ config: StelOrderProviderConfig;
2560
2698
  } | {
2561
2699
  provider: 'shopify';
2562
2700
  config: ShopifyProviderConfig;
@@ -2602,4 +2740,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
2602
2740
  */
2603
2741
  declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
2604
2742
 
2605
- 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, 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 };
2743
+ 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, type RetryConfig, 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, createFetchWithRetry, createLogger, createProvider, extractErrorMessage, fetchWithRetry, filterByChannel, filterGlobalOnly, geocodeAddress, getBackendProviderId, getCapabilityDescription, getChannelScope, isBackendCapabilities, isGlobalEntity, isProviderType, isScopedToChannel, moneyToNumber, moneyToNumberSafe, numberToMoney, partitionByChannel, planFulfillment, transformFulfillmentOption, transformInventoryLevel, transformStockLocation, transformStorefrontConfig, validateAssignedBy, validateChannelId, validateChannelScopeAssignment, validateEntityId, validatePaymentId };