@thorprovider/adapters 4.2.0 → 4.3.0
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 +6 -0
- package/PROVIDER_IMPLEMENTATION_ANALYSIS.md +659 -0
- package/README.md +19 -0
- package/dist/index.d.mts +249 -2
- package/dist/index.d.ts +249 -2
- package/dist/index.js +1450 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1448 -2
- package/dist/index.mjs.map +1 -1
- package/docs/RETRY_SOLUTION_SUMMARY.md +26 -11
- package/docs/authentication.md +115 -62
- package/docs/capabilities-system.md +34 -2
- package/docs/category-customization.md +37 -29
- package/docs/fetch-reliability-solution.md +127 -278
- package/docs/getting-started.md +43 -29
- package/docs/profile-management.md +68 -38
- package/docs/providers-overview.md +14 -0
- package/docs/services-overview.md +20 -2
- package/package.json +10 -6
- package/quick-reference.md +34 -0
- package/src/factory/index.ts +4 -0
- package/src/index.ts +3 -0
- package/src/providers/index.ts +3 -0
- package/src/providers/medusa/admin.test.ts +404 -0
- package/src/providers/medusa/admin.ts +442 -0
- package/src/providers/medusa/auth.test.ts +137 -0
- package/src/providers/medusa/auth.ts +96 -1
- package/src/providers/medusa/index.ts +21 -1
- package/src/providers/shopify/auth.ts +6 -0
- package/src/providers/stelorder/client.test-helpers.ts +3 -0
- package/src/providers/stelorder/client.test.ts +58 -0
- package/src/providers/stelorder/client.ts +326 -0
- package/src/providers/stelorder/index.test.ts +48 -0
- package/src/providers/stelorder/index.ts +685 -0
- package/src/providers/stelorder/live-smoke.test.ts +54 -0
- package/src/providers/stelorder/transforms.test.ts +103 -0
- package/src/providers/stelorder/transforms.ts +631 -0
- package/src/resilience/README.md +70 -48
- package/src/types/capabilities.types.ts +51 -0
- package/vitest.config.ts +13 -0
- package/vitest.setup.ts +6 -0
- package/.turbo/turbo-build.log +0 -18
- package/dist/.tsbuildinfo +0 -1
- package/src/core/errors.js +0 -161
- package/src/core/fetch-utils.js +0 -240
- package/src/core/logger.js +0 -63
- package/src/metadata/channel-scope-validation.js +0 -136
- package/src/metadata/channel-scope.js +0 -174
- package/src/metadata/index.js +0 -31
- package/src/providers/medusa/auth.js +0 -601
- package/src/providers/medusa/index.js +0 -2485
- package/src/providers/medusa/payment.js +0 -265
- package/src/providers/medusa/transforms.js +0 -505
- package/src/types/capabilities.types.js +0 -141
- package/src/types/provider.js +0 -9
- package/src/utils/payment-utils.js +0 -152
package/README.md
CHANGED
|
@@ -133,6 +133,7 @@ Need e-commerce backend integration?
|
|
|
133
133
|
Currently implemented:
|
|
134
134
|
- ✅ **Mock** — Fixture-backed provider for local development, previews, and backend-optional storefront bootstrapping
|
|
135
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).
|
|
136
137
|
|
|
137
138
|
Planned (Phase 2–3):
|
|
138
139
|
- 🟡 **Shopify** — In progress
|
|
@@ -162,6 +163,17 @@ const commerce = createProvider({
|
|
|
162
163
|
}
|
|
163
164
|
});
|
|
164
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
|
+
|
|
165
177
|
const products = await commerce.getProducts();
|
|
166
178
|
```
|
|
167
179
|
|
|
@@ -438,6 +450,7 @@ if (commerce.capabilities.updateEmail) {
|
|
|
438
450
|
| Platform | Status | Documentation |
|
|
439
451
|
|----------|--------|---------------|
|
|
440
452
|
| **Medusa v2** | ✅ Production Ready | [Medusa Docs](https://docs.medusajs.com/) |
|
|
453
|
+
| **Stel Order** | ✅ ERP Adapter (v1) | Catalog, CRM, orders — no cart/checkout/auth |
|
|
441
454
|
| **Shopify** | 🚧 Planned | [Shopify API](https://shopify.dev/api/storefront) |
|
|
442
455
|
| **WooCommerce** | 🗓️ Roadmap | [WooCommerce API](https://woocommerce.github.io/woocommerce-rest-api-docs/) |
|
|
443
456
|
| **BigCommerce** | 🗓️ Roadmap | [BigCommerce API](https://developer.bigcommerce.com/) |
|
|
@@ -465,6 +478,11 @@ if (commerce.capabilities.updateEmail) {
|
|
|
465
478
|
- [Add New Service](../../docs/workflows/legacy/add-adapter-service.md) - Service workflow
|
|
466
479
|
- [Type Definitions](./src/types/) - Full TypeScript types
|
|
467
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
|
+
|
|
468
486
|
---
|
|
469
487
|
|
|
470
488
|
## Examples
|
|
@@ -584,6 +602,7 @@ const products = await commerce.getProducts();
|
|
|
584
602
|
├── types/ # Unified types (Product, Cart, etc.)
|
|
585
603
|
├── providers/ # Provider implementations
|
|
586
604
|
│ ├── medusa/ # Medusa v2 provider
|
|
605
|
+
│ ├── stelorder/ # Stel Order ERP adapter
|
|
587
606
|
│ └── shopify/ # (coming soon)
|
|
588
607
|
├── core/ # Core utilities (errors, logger)
|
|
589
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, GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, 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
|
*
|
|
@@ -1361,6 +1368,153 @@ declare function validateChannelScopeAssignment(entityId: string, channelId: str
|
|
|
1361
1368
|
*/
|
|
1362
1369
|
declare function assertEntityBelongsToChannel(entity: ChannelScopeable, expectedChannelId: string): void;
|
|
1363
1370
|
|
|
1371
|
+
/**
|
|
1372
|
+
* @fileoverview Medusa Multi-Tenant Admin Client
|
|
1373
|
+
* @module @thorprovider/adapters/providers/medusa/admin
|
|
1374
|
+
*
|
|
1375
|
+
* Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce
|
|
1376
|
+
* multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)
|
|
1377
|
+
* to be provided when creating the Medusa provider.
|
|
1378
|
+
*
|
|
1379
|
+
* Every method performs a raw `fetch` against the Medusa backend using the
|
|
1380
|
+
* admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client
|
|
1381
|
+
* does not expose these custom Thor plugin routes, so we use direct HTTP calls.
|
|
1382
|
+
*
|
|
1383
|
+
* Endpoint reference: `multitenant-api-contract.md`
|
|
1384
|
+
*/
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Configuration required to instantiate the admin client.
|
|
1388
|
+
*/
|
|
1389
|
+
interface MedusaAdminClientConfig {
|
|
1390
|
+
/** Medusa backend base URL */
|
|
1391
|
+
baseUrl: string;
|
|
1392
|
+
/** Secret admin API key (x-medusa-access-token) */
|
|
1393
|
+
apiKey: string;
|
|
1394
|
+
/** Enable debug logging */
|
|
1395
|
+
debug?: boolean;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).
|
|
1399
|
+
*
|
|
1400
|
+
* All methods throw `ProviderAPIError` on non-2xx responses.
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* const admin = new MedusaAdminClient({
|
|
1405
|
+
* baseUrl: process.env.MEDUSA_BACKEND_URL!,
|
|
1406
|
+
* apiKey: process.env.MEDUSA_ADMIN_API_KEY!,
|
|
1407
|
+
* });
|
|
1408
|
+
*
|
|
1409
|
+
* const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
declare class MedusaAdminClient {
|
|
1413
|
+
private baseUrl;
|
|
1414
|
+
private apiKey;
|
|
1415
|
+
private logger;
|
|
1416
|
+
constructor(config: MedusaAdminClientConfig);
|
|
1417
|
+
private request;
|
|
1418
|
+
/**
|
|
1419
|
+
* Paginated list of customers linked to a sales channel.
|
|
1420
|
+
*
|
|
1421
|
+
* `GET /admin/thor/sales-channels/:id/customers`
|
|
1422
|
+
*/
|
|
1423
|
+
getChannelCustomers(salesChannelId: string, options?: GetChannelCustomersOptions): Promise<GetChannelCustomersResponse>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Publishable API keys associated with a sales channel.
|
|
1426
|
+
*
|
|
1427
|
+
* `GET /admin/thor/sales-channels/:id/api-keys`
|
|
1428
|
+
*/
|
|
1429
|
+
getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Product categories assigned to a sales channel.
|
|
1432
|
+
*
|
|
1433
|
+
* `GET /admin/thor/sales-channels/:id/categories`
|
|
1434
|
+
*/
|
|
1435
|
+
getChannelCategories(salesChannelId: string, options?: GetChannelCategoriesOptions): Promise<GetChannelCategoriesResponse>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Sales channels to which a category is assigned.
|
|
1438
|
+
*
|
|
1439
|
+
* `GET /admin/thor/categories/:id/sales-channels`
|
|
1440
|
+
*/
|
|
1441
|
+
getCategorySalesChannels(categoryId: string): Promise<GetCategorySalesChannelsResponse>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Assign a category to one or more sales channels (idempotent).
|
|
1444
|
+
*
|
|
1445
|
+
* `POST /admin/thor/categories/:id/sales-channels`
|
|
1446
|
+
*/
|
|
1447
|
+
assignCategoryToChannels(categoryId: string, body: AssignCategoriesToChannelsBody): Promise<AssignCategoriesToChannelsResponse>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Remove category assignment from one or more sales channels (idempotent).
|
|
1450
|
+
*
|
|
1451
|
+
* `DELETE /admin/thor/categories/:id/sales-channels`
|
|
1452
|
+
*/
|
|
1453
|
+
unassignCategoryFromChannels(categoryId: string, body: UnassignCategoriesFromChannelsBody): Promise<UnassignCategoriesFromChannelsResponse>;
|
|
1454
|
+
/**
|
|
1455
|
+
* Sales channels to which a collection is assigned.
|
|
1456
|
+
*
|
|
1457
|
+
* `GET /admin/thor/collections/:id/sales-channels`
|
|
1458
|
+
*/
|
|
1459
|
+
getCollectionSalesChannels(collectionId: string): Promise<GetCollectionSalesChannelsResponse>;
|
|
1460
|
+
/**
|
|
1461
|
+
* Assign a collection to one or more sales channels (idempotent).
|
|
1462
|
+
*
|
|
1463
|
+
* `POST /admin/thor/collections/:id/sales-channels`
|
|
1464
|
+
*/
|
|
1465
|
+
assignCollectionToChannels(collectionId: string, body: AssignCollectionsToChannelsBody): Promise<AssignCollectionsToChannelsResponse>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Remove collection assignment from one or more sales channels (idempotent).
|
|
1468
|
+
*
|
|
1469
|
+
* `DELETE /admin/thor/collections/:id/sales-channels`
|
|
1470
|
+
*/
|
|
1471
|
+
unassignCollectionFromChannels(collectionId: string, body: UnassignCollectionsFromChannelsBody): Promise<UnassignCollectionsFromChannelsResponse>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Read the visual storefront configuration for a channel.
|
|
1474
|
+
* `:id` is the `sales_channel_id`.
|
|
1475
|
+
*
|
|
1476
|
+
* `GET /admin/thor/storefront-config/:id`
|
|
1477
|
+
*/
|
|
1478
|
+
getStorefrontConfig(salesChannelId: string): Promise<GetAdminStorefrontConfigResponse>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Update the visual storefront configuration for a channel.
|
|
1481
|
+
* Triggers the `storefront_config.updated` event → ISR webhook.
|
|
1482
|
+
*
|
|
1483
|
+
* `PUT /admin/thor/storefront-config/:id`
|
|
1484
|
+
*/
|
|
1485
|
+
updateStorefrontConfig(salesChannelId: string, body: UpdateStorefrontConfigBody): Promise<UpdateStorefrontConfigResponse>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Read the active Site Designer configuration for a channel, including the
|
|
1488
|
+
* last 10 history entries.
|
|
1489
|
+
*
|
|
1490
|
+
* `GET /admin/thor/site-config/:sales_channel_id`
|
|
1491
|
+
*/
|
|
1492
|
+
getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Update the Site Designer configuration for a channel.
|
|
1495
|
+
* Creates a new history entry on every PUT.
|
|
1496
|
+
*
|
|
1497
|
+
* `PUT /admin/thor/site-config/:sales_channel_id`
|
|
1498
|
+
*/
|
|
1499
|
+
updateSiteConfig(salesChannelId: string, body: UpdateSiteConfigBody): Promise<UpdateSiteConfigResponse>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Full paginated history of Site Designer versions for a channel.
|
|
1502
|
+
* Entries are immutable — they are never deleted.
|
|
1503
|
+
*
|
|
1504
|
+
* `GET /admin/thor/site-config/:sales_channel_id/history`
|
|
1505
|
+
*/
|
|
1506
|
+
getSiteConfigHistory(salesChannelId: string, options?: GetAdminSiteConfigHistoryOptions): Promise<GetAdminSiteConfigHistoryResponse>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Restore a previous Site Designer version.
|
|
1509
|
+
* Internally runs the update workflow with the stored config of the target
|
|
1510
|
+
* version — this creates a **new** history entry and does NOT mutate past
|
|
1511
|
+
* entries.
|
|
1512
|
+
*
|
|
1513
|
+
* `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
|
|
1514
|
+
*/
|
|
1515
|
+
restoreSiteConfig(salesChannelId: string, version: string): Promise<RestoreSiteConfigResponse>;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1364
1518
|
/**
|
|
1365
1519
|
* Medusa provider configuration
|
|
1366
1520
|
*/
|
|
@@ -1452,6 +1606,18 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
1452
1606
|
* Only created when adminConfig.apiKey is provided.
|
|
1453
1607
|
*/
|
|
1454
1608
|
private sdkAdmin?;
|
|
1609
|
+
/**
|
|
1610
|
+
* Admin client for Thor multi-tenant endpoints (`/admin/thor/`).
|
|
1611
|
+
* Available when `adminConfig.apiKey` is provided.
|
|
1612
|
+
*
|
|
1613
|
+
* @example
|
|
1614
|
+
* ```typescript
|
|
1615
|
+
* const { customers } = await commerce.admin.getChannelCustomers('sc_01JXXXXX');
|
|
1616
|
+
* const { api_keys } = await commerce.admin.getChannelApiKeys('sc_01JXXXXX');
|
|
1617
|
+
* await commerce.admin.updateStorefrontConfig('sc_01JXXXXX', { theme_accent_color: '#EF4444', ... });
|
|
1618
|
+
* ```
|
|
1619
|
+
*/
|
|
1620
|
+
readonly admin?: MedusaAdminClient;
|
|
1455
1621
|
/** Cached distinct product status values — rarely changes, cached for process lifetime */
|
|
1456
1622
|
private _cachedProductStatuses;
|
|
1457
1623
|
/**
|
|
@@ -2461,6 +2627,84 @@ declare class MagentoProvider implements CommerceProvider {
|
|
|
2461
2627
|
isStorefrontRequired(): boolean;
|
|
2462
2628
|
}
|
|
2463
2629
|
|
|
2630
|
+
interface StelOrderProviderConfig extends ProviderConfig {
|
|
2631
|
+
baseUrl: string;
|
|
2632
|
+
apiKey?: string;
|
|
2633
|
+
publishableKey?: string;
|
|
2634
|
+
currencyCode?: string;
|
|
2635
|
+
companyName?: string;
|
|
2636
|
+
storefrontId?: string;
|
|
2637
|
+
retry?: RetryConfig;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
declare class StelOrderProvider implements CommerceProvider {
|
|
2641
|
+
readonly name = "stelorder";
|
|
2642
|
+
readonly version = "1.0.0";
|
|
2643
|
+
readonly capabilities: BackendCapabilities;
|
|
2644
|
+
private readonly client;
|
|
2645
|
+
private readonly logger;
|
|
2646
|
+
private readonly currencyCode;
|
|
2647
|
+
private readonly storefrontId;
|
|
2648
|
+
private readonly companyName;
|
|
2649
|
+
constructor(config: StelOrderProviderConfig);
|
|
2650
|
+
getProduct(handle: string, _options?: {
|
|
2651
|
+
regionId?: string;
|
|
2652
|
+
}): Promise<Product | undefined>;
|
|
2653
|
+
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2654
|
+
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2655
|
+
getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
|
|
2656
|
+
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2657
|
+
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2658
|
+
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2659
|
+
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2660
|
+
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2661
|
+
getStockLocations(_params?: {
|
|
2662
|
+
salesChannelId?: string;
|
|
2663
|
+
}): Promise<StockLocation[]>;
|
|
2664
|
+
checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
|
|
2665
|
+
validateCartStock(_cartId: string): Promise<StockValidation>;
|
|
2666
|
+
getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
|
|
2667
|
+
createCart(_options?: {
|
|
2668
|
+
regionId?: string;
|
|
2669
|
+
}): Promise<Cart>;
|
|
2670
|
+
getCart(_cartId: string): Promise<Cart | undefined>;
|
|
2671
|
+
addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
|
|
2672
|
+
removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
|
|
2673
|
+
updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
|
|
2674
|
+
completeCheckout(_cartId: string): Promise<Order>;
|
|
2675
|
+
getRegionCountries(_regionId: string): Promise<Country[]>;
|
|
2676
|
+
addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
|
|
2677
|
+
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2678
|
+
applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
|
|
2679
|
+
removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
|
|
2680
|
+
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2681
|
+
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2682
|
+
getCustomer(customerId: string): Promise<Customer | undefined>;
|
|
2683
|
+
getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
|
|
2684
|
+
updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
|
|
2685
|
+
getOrder(orderId: string): Promise<Order | undefined>;
|
|
2686
|
+
getOrders(options: GetOrdersOptions): Promise<Order[]>;
|
|
2687
|
+
getAdminOrders(options?: {
|
|
2688
|
+
search?: string;
|
|
2689
|
+
status?: string | string[];
|
|
2690
|
+
limit?: number;
|
|
2691
|
+
offset?: number;
|
|
2692
|
+
}): Promise<{
|
|
2693
|
+
orders: Order[];
|
|
2694
|
+
count: number;
|
|
2695
|
+
}>;
|
|
2696
|
+
cancelOrder(_orderId: string): Promise<Order>;
|
|
2697
|
+
createFulfillment(_orderId: string, _items?: Array<{
|
|
2698
|
+
id: string;
|
|
2699
|
+
quantity: number;
|
|
2700
|
+
}>): Promise<void>;
|
|
2701
|
+
createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
|
|
2702
|
+
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2703
|
+
isStorefrontRequired(): boolean;
|
|
2704
|
+
private notSupported;
|
|
2705
|
+
private wrapError;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2464
2708
|
interface MockProviderConfig extends ProviderConfig {
|
|
2465
2709
|
currencyCode?: string;
|
|
2466
2710
|
siteUrl?: string;
|
|
@@ -2557,6 +2801,9 @@ type ProviderFactoryConfig = {
|
|
|
2557
2801
|
} | {
|
|
2558
2802
|
provider: 'medusa';
|
|
2559
2803
|
config: MedusaProviderConfig;
|
|
2804
|
+
} | {
|
|
2805
|
+
provider: 'stelorder';
|
|
2806
|
+
config: StelOrderProviderConfig;
|
|
2560
2807
|
} | {
|
|
2561
2808
|
provider: 'shopify';
|
|
2562
2809
|
config: ShopifyProviderConfig;
|
|
@@ -2602,4 +2849,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
|
|
|
2602
2849
|
*/
|
|
2603
2850
|
declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
|
|
2604
2851
|
|
|
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 };
|
|
2852
|
+
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, GetChannelCustomersOptions, GetChannelCustomersResponse, GetChannelApiKeysResponse, GetChannelCategoriesOptions, GetChannelCategoriesResponse, GetCategorySalesChannelsResponse, AssignCategoriesToChannelsBody, AssignCategoriesToChannelsResponse, UnassignCategoriesFromChannelsBody, UnassignCategoriesFromChannelsResponse, GetCollectionSalesChannelsResponse, AssignCollectionsToChannelsBody, AssignCollectionsToChannelsResponse, UnassignCollectionsFromChannelsBody, UnassignCollectionsFromChannelsResponse, GetAdminStorefrontConfigResponse, UpdateStorefrontConfigBody, UpdateStorefrontConfigResponse, GetAdminSiteConfigResponse, UpdateSiteConfigBody, UpdateSiteConfigResponse, GetAdminSiteConfigHistoryOptions, GetAdminSiteConfigHistoryResponse, RestoreSiteConfigResponse, 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
|
*
|
|
@@ -1361,6 +1368,153 @@ declare function validateChannelScopeAssignment(entityId: string, channelId: str
|
|
|
1361
1368
|
*/
|
|
1362
1369
|
declare function assertEntityBelongsToChannel(entity: ChannelScopeable, expectedChannelId: string): void;
|
|
1363
1370
|
|
|
1371
|
+
/**
|
|
1372
|
+
* @fileoverview Medusa Multi-Tenant Admin Client
|
|
1373
|
+
* @module @thorprovider/adapters/providers/medusa/admin
|
|
1374
|
+
*
|
|
1375
|
+
* Wrapper methods for all `/admin/thor/` endpoints defined in the Thor Commerce
|
|
1376
|
+
* multi-tenant API contract. Requires an admin API key (`adminConfig.apiKey`)
|
|
1377
|
+
* to be provided when creating the Medusa provider.
|
|
1378
|
+
*
|
|
1379
|
+
* Every method performs a raw `fetch` against the Medusa backend using the
|
|
1380
|
+
* admin API key (`x-medusa-access-token`) — the Medusa JS-SDK's admin client
|
|
1381
|
+
* does not expose these custom Thor plugin routes, so we use direct HTTP calls.
|
|
1382
|
+
*
|
|
1383
|
+
* Endpoint reference: `multitenant-api-contract.md`
|
|
1384
|
+
*/
|
|
1385
|
+
|
|
1386
|
+
/**
|
|
1387
|
+
* Configuration required to instantiate the admin client.
|
|
1388
|
+
*/
|
|
1389
|
+
interface MedusaAdminClientConfig {
|
|
1390
|
+
/** Medusa backend base URL */
|
|
1391
|
+
baseUrl: string;
|
|
1392
|
+
/** Secret admin API key (x-medusa-access-token) */
|
|
1393
|
+
apiKey: string;
|
|
1394
|
+
/** Enable debug logging */
|
|
1395
|
+
debug?: boolean;
|
|
1396
|
+
}
|
|
1397
|
+
/**
|
|
1398
|
+
* HTTP client for Thor Commerce multi-tenant admin endpoints (`/admin/thor/`).
|
|
1399
|
+
*
|
|
1400
|
+
* All methods throw `ProviderAPIError` on non-2xx responses.
|
|
1401
|
+
*
|
|
1402
|
+
* @example
|
|
1403
|
+
* ```typescript
|
|
1404
|
+
* const admin = new MedusaAdminClient({
|
|
1405
|
+
* baseUrl: process.env.MEDUSA_BACKEND_URL!,
|
|
1406
|
+
* apiKey: process.env.MEDUSA_ADMIN_API_KEY!,
|
|
1407
|
+
* });
|
|
1408
|
+
*
|
|
1409
|
+
* const { customers } = await admin.getChannelCustomers('sc_01JXXXXX');
|
|
1410
|
+
* ```
|
|
1411
|
+
*/
|
|
1412
|
+
declare class MedusaAdminClient {
|
|
1413
|
+
private baseUrl;
|
|
1414
|
+
private apiKey;
|
|
1415
|
+
private logger;
|
|
1416
|
+
constructor(config: MedusaAdminClientConfig);
|
|
1417
|
+
private request;
|
|
1418
|
+
/**
|
|
1419
|
+
* Paginated list of customers linked to a sales channel.
|
|
1420
|
+
*
|
|
1421
|
+
* `GET /admin/thor/sales-channels/:id/customers`
|
|
1422
|
+
*/
|
|
1423
|
+
getChannelCustomers(salesChannelId: string, options?: GetChannelCustomersOptions): Promise<GetChannelCustomersResponse>;
|
|
1424
|
+
/**
|
|
1425
|
+
* Publishable API keys associated with a sales channel.
|
|
1426
|
+
*
|
|
1427
|
+
* `GET /admin/thor/sales-channels/:id/api-keys`
|
|
1428
|
+
*/
|
|
1429
|
+
getChannelApiKeys(salesChannelId: string): Promise<GetChannelApiKeysResponse>;
|
|
1430
|
+
/**
|
|
1431
|
+
* Product categories assigned to a sales channel.
|
|
1432
|
+
*
|
|
1433
|
+
* `GET /admin/thor/sales-channels/:id/categories`
|
|
1434
|
+
*/
|
|
1435
|
+
getChannelCategories(salesChannelId: string, options?: GetChannelCategoriesOptions): Promise<GetChannelCategoriesResponse>;
|
|
1436
|
+
/**
|
|
1437
|
+
* Sales channels to which a category is assigned.
|
|
1438
|
+
*
|
|
1439
|
+
* `GET /admin/thor/categories/:id/sales-channels`
|
|
1440
|
+
*/
|
|
1441
|
+
getCategorySalesChannels(categoryId: string): Promise<GetCategorySalesChannelsResponse>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Assign a category to one or more sales channels (idempotent).
|
|
1444
|
+
*
|
|
1445
|
+
* `POST /admin/thor/categories/:id/sales-channels`
|
|
1446
|
+
*/
|
|
1447
|
+
assignCategoryToChannels(categoryId: string, body: AssignCategoriesToChannelsBody): Promise<AssignCategoriesToChannelsResponse>;
|
|
1448
|
+
/**
|
|
1449
|
+
* Remove category assignment from one or more sales channels (idempotent).
|
|
1450
|
+
*
|
|
1451
|
+
* `DELETE /admin/thor/categories/:id/sales-channels`
|
|
1452
|
+
*/
|
|
1453
|
+
unassignCategoryFromChannels(categoryId: string, body: UnassignCategoriesFromChannelsBody): Promise<UnassignCategoriesFromChannelsResponse>;
|
|
1454
|
+
/**
|
|
1455
|
+
* Sales channels to which a collection is assigned.
|
|
1456
|
+
*
|
|
1457
|
+
* `GET /admin/thor/collections/:id/sales-channels`
|
|
1458
|
+
*/
|
|
1459
|
+
getCollectionSalesChannels(collectionId: string): Promise<GetCollectionSalesChannelsResponse>;
|
|
1460
|
+
/**
|
|
1461
|
+
* Assign a collection to one or more sales channels (idempotent).
|
|
1462
|
+
*
|
|
1463
|
+
* `POST /admin/thor/collections/:id/sales-channels`
|
|
1464
|
+
*/
|
|
1465
|
+
assignCollectionToChannels(collectionId: string, body: AssignCollectionsToChannelsBody): Promise<AssignCollectionsToChannelsResponse>;
|
|
1466
|
+
/**
|
|
1467
|
+
* Remove collection assignment from one or more sales channels (idempotent).
|
|
1468
|
+
*
|
|
1469
|
+
* `DELETE /admin/thor/collections/:id/sales-channels`
|
|
1470
|
+
*/
|
|
1471
|
+
unassignCollectionFromChannels(collectionId: string, body: UnassignCollectionsFromChannelsBody): Promise<UnassignCollectionsFromChannelsResponse>;
|
|
1472
|
+
/**
|
|
1473
|
+
* Read the visual storefront configuration for a channel.
|
|
1474
|
+
* `:id` is the `sales_channel_id`.
|
|
1475
|
+
*
|
|
1476
|
+
* `GET /admin/thor/storefront-config/:id`
|
|
1477
|
+
*/
|
|
1478
|
+
getStorefrontConfig(salesChannelId: string): Promise<GetAdminStorefrontConfigResponse>;
|
|
1479
|
+
/**
|
|
1480
|
+
* Update the visual storefront configuration for a channel.
|
|
1481
|
+
* Triggers the `storefront_config.updated` event → ISR webhook.
|
|
1482
|
+
*
|
|
1483
|
+
* `PUT /admin/thor/storefront-config/:id`
|
|
1484
|
+
*/
|
|
1485
|
+
updateStorefrontConfig(salesChannelId: string, body: UpdateStorefrontConfigBody): Promise<UpdateStorefrontConfigResponse>;
|
|
1486
|
+
/**
|
|
1487
|
+
* Read the active Site Designer configuration for a channel, including the
|
|
1488
|
+
* last 10 history entries.
|
|
1489
|
+
*
|
|
1490
|
+
* `GET /admin/thor/site-config/:sales_channel_id`
|
|
1491
|
+
*/
|
|
1492
|
+
getSiteConfig(salesChannelId: string): Promise<GetAdminSiteConfigResponse>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Update the Site Designer configuration for a channel.
|
|
1495
|
+
* Creates a new history entry on every PUT.
|
|
1496
|
+
*
|
|
1497
|
+
* `PUT /admin/thor/site-config/:sales_channel_id`
|
|
1498
|
+
*/
|
|
1499
|
+
updateSiteConfig(salesChannelId: string, body: UpdateSiteConfigBody): Promise<UpdateSiteConfigResponse>;
|
|
1500
|
+
/**
|
|
1501
|
+
* Full paginated history of Site Designer versions for a channel.
|
|
1502
|
+
* Entries are immutable — they are never deleted.
|
|
1503
|
+
*
|
|
1504
|
+
* `GET /admin/thor/site-config/:sales_channel_id/history`
|
|
1505
|
+
*/
|
|
1506
|
+
getSiteConfigHistory(salesChannelId: string, options?: GetAdminSiteConfigHistoryOptions): Promise<GetAdminSiteConfigHistoryResponse>;
|
|
1507
|
+
/**
|
|
1508
|
+
* Restore a previous Site Designer version.
|
|
1509
|
+
* Internally runs the update workflow with the stored config of the target
|
|
1510
|
+
* version — this creates a **new** history entry and does NOT mutate past
|
|
1511
|
+
* entries.
|
|
1512
|
+
*
|
|
1513
|
+
* `POST /admin/thor/site-config/:sales_channel_id/restore/:version`
|
|
1514
|
+
*/
|
|
1515
|
+
restoreSiteConfig(salesChannelId: string, version: string): Promise<RestoreSiteConfigResponse>;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1364
1518
|
/**
|
|
1365
1519
|
* Medusa provider configuration
|
|
1366
1520
|
*/
|
|
@@ -1452,6 +1606,18 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
1452
1606
|
* Only created when adminConfig.apiKey is provided.
|
|
1453
1607
|
*/
|
|
1454
1608
|
private sdkAdmin?;
|
|
1609
|
+
/**
|
|
1610
|
+
* Admin client for Thor multi-tenant endpoints (`/admin/thor/`).
|
|
1611
|
+
* Available when `adminConfig.apiKey` is provided.
|
|
1612
|
+
*
|
|
1613
|
+
* @example
|
|
1614
|
+
* ```typescript
|
|
1615
|
+
* const { customers } = await commerce.admin.getChannelCustomers('sc_01JXXXXX');
|
|
1616
|
+
* const { api_keys } = await commerce.admin.getChannelApiKeys('sc_01JXXXXX');
|
|
1617
|
+
* await commerce.admin.updateStorefrontConfig('sc_01JXXXXX', { theme_accent_color: '#EF4444', ... });
|
|
1618
|
+
* ```
|
|
1619
|
+
*/
|
|
1620
|
+
readonly admin?: MedusaAdminClient;
|
|
1455
1621
|
/** Cached distinct product status values — rarely changes, cached for process lifetime */
|
|
1456
1622
|
private _cachedProductStatuses;
|
|
1457
1623
|
/**
|
|
@@ -2461,6 +2627,84 @@ declare class MagentoProvider implements CommerceProvider {
|
|
|
2461
2627
|
isStorefrontRequired(): boolean;
|
|
2462
2628
|
}
|
|
2463
2629
|
|
|
2630
|
+
interface StelOrderProviderConfig extends ProviderConfig {
|
|
2631
|
+
baseUrl: string;
|
|
2632
|
+
apiKey?: string;
|
|
2633
|
+
publishableKey?: string;
|
|
2634
|
+
currencyCode?: string;
|
|
2635
|
+
companyName?: string;
|
|
2636
|
+
storefrontId?: string;
|
|
2637
|
+
retry?: RetryConfig;
|
|
2638
|
+
}
|
|
2639
|
+
|
|
2640
|
+
declare class StelOrderProvider implements CommerceProvider {
|
|
2641
|
+
readonly name = "stelorder";
|
|
2642
|
+
readonly version = "1.0.0";
|
|
2643
|
+
readonly capabilities: BackendCapabilities;
|
|
2644
|
+
private readonly client;
|
|
2645
|
+
private readonly logger;
|
|
2646
|
+
private readonly currencyCode;
|
|
2647
|
+
private readonly storefrontId;
|
|
2648
|
+
private readonly companyName;
|
|
2649
|
+
constructor(config: StelOrderProviderConfig);
|
|
2650
|
+
getProduct(handle: string, _options?: {
|
|
2651
|
+
regionId?: string;
|
|
2652
|
+
}): Promise<Product | undefined>;
|
|
2653
|
+
getProducts(options?: GetProductsOptions): Promise<Product[]>;
|
|
2654
|
+
getProductRecommendations(_productId: string): Promise<Product[]>;
|
|
2655
|
+
getCategory(idOrHandle: string): Promise<ProductCategory | undefined>;
|
|
2656
|
+
getCategories(options?: GetCategoriesOptions): Promise<ProductCategory[]>;
|
|
2657
|
+
getCategoryProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2658
|
+
getCollection(handle: string): Promise<Collection | undefined>;
|
|
2659
|
+
getCollections(options?: GetCollectionsOptions): Promise<Collection[]>;
|
|
2660
|
+
getCollectionProducts(handle: string, options?: CollectionProductsOptions): Promise<Product[]>;
|
|
2661
|
+
getStockLocations(_params?: {
|
|
2662
|
+
salesChannelId?: string;
|
|
2663
|
+
}): Promise<StockLocation[]>;
|
|
2664
|
+
checkInventoryLevels(variantId: string, _salesChannelId?: string): Promise<InventoryLevel[]>;
|
|
2665
|
+
validateCartStock(_cartId: string): Promise<StockValidation>;
|
|
2666
|
+
getFulfillmentOptions(_cartId: string, _salesChannelId: string): Promise<FulfillmentOption[]>;
|
|
2667
|
+
createCart(_options?: {
|
|
2668
|
+
regionId?: string;
|
|
2669
|
+
}): Promise<Cart>;
|
|
2670
|
+
getCart(_cartId: string): Promise<Cart | undefined>;
|
|
2671
|
+
addToCart(_cartId: string, _lines: CartLineInput[]): Promise<Cart>;
|
|
2672
|
+
removeFromCart(_cartId: string, _lineIds: string[]): Promise<Cart>;
|
|
2673
|
+
updateCart(_cartId: string, _lines: CartLineUpdate[]): Promise<Cart>;
|
|
2674
|
+
completeCheckout(_cartId: string): Promise<Order>;
|
|
2675
|
+
getRegionCountries(_regionId: string): Promise<Country[]>;
|
|
2676
|
+
addShippingMethod(_cartId: string, _methodId: string): Promise<Cart>;
|
|
2677
|
+
initiatePaymentSession(_cartId: string, _providerId: string): Promise<void>;
|
|
2678
|
+
applyDiscountCode(_cartId: string, _code: string): Promise<Cart>;
|
|
2679
|
+
removeDiscountCode(_cartId: string, _code: string): Promise<Cart>;
|
|
2680
|
+
getPaymentMethods(_options: PaymentMethodsOptions): Promise<PaymentMethod[]>;
|
|
2681
|
+
getShippingMethods(_cartId: string): Promise<ShippingMethod[]>;
|
|
2682
|
+
getCustomer(customerId: string): Promise<Customer | undefined>;
|
|
2683
|
+
getCustomers(options?: GetCustomersOptions): Promise<Customer[]>;
|
|
2684
|
+
updateCustomer(customerId: string, data: Partial<Omit<Customer, 'id' | 'createdAt'>>): Promise<Customer>;
|
|
2685
|
+
getOrder(orderId: string): Promise<Order | undefined>;
|
|
2686
|
+
getOrders(options: GetOrdersOptions): Promise<Order[]>;
|
|
2687
|
+
getAdminOrders(options?: {
|
|
2688
|
+
search?: string;
|
|
2689
|
+
status?: string | string[];
|
|
2690
|
+
limit?: number;
|
|
2691
|
+
offset?: number;
|
|
2692
|
+
}): Promise<{
|
|
2693
|
+
orders: Order[];
|
|
2694
|
+
count: number;
|
|
2695
|
+
}>;
|
|
2696
|
+
cancelOrder(_orderId: string): Promise<Order>;
|
|
2697
|
+
createFulfillment(_orderId: string, _items?: Array<{
|
|
2698
|
+
id: string;
|
|
2699
|
+
quantity: number;
|
|
2700
|
+
}>): Promise<void>;
|
|
2701
|
+
createRefund(_orderId: string, _amount?: number, _reason?: string): Promise<void>;
|
|
2702
|
+
getStorefrontContext(): Promise<StorefrontContext>;
|
|
2703
|
+
isStorefrontRequired(): boolean;
|
|
2704
|
+
private notSupported;
|
|
2705
|
+
private wrapError;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2464
2708
|
interface MockProviderConfig extends ProviderConfig {
|
|
2465
2709
|
currencyCode?: string;
|
|
2466
2710
|
siteUrl?: string;
|
|
@@ -2557,6 +2801,9 @@ type ProviderFactoryConfig = {
|
|
|
2557
2801
|
} | {
|
|
2558
2802
|
provider: 'medusa';
|
|
2559
2803
|
config: MedusaProviderConfig;
|
|
2804
|
+
} | {
|
|
2805
|
+
provider: 'stelorder';
|
|
2806
|
+
config: StelOrderProviderConfig;
|
|
2560
2807
|
} | {
|
|
2561
2808
|
provider: 'shopify';
|
|
2562
2809
|
config: ShopifyProviderConfig;
|
|
@@ -2602,4 +2849,4 @@ declare function createProvider(options: ProviderFactoryConfig | RuntimeProvider
|
|
|
2602
2849
|
*/
|
|
2603
2850
|
declare function isProviderType<T extends ProviderType>(provider: CommerceProvider, type: T): boolean;
|
|
2604
2851
|
|
|
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 };
|
|
2852
|
+
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 };
|