@thorprovider/adapters 4.2.1 → 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/PROVIDER_IMPLEMENTATION_ANALYSIS.md +659 -0
- package/dist/index.d.mts +160 -1
- package/dist/index.d.ts +160 -1
- package/dist/index.js +384 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +384 -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 +4 -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/services-overview.md +4 -2
- package/package.json +1 -1
- package/quick-reference.md +33 -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/resilience/README.md +70 -48
- 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/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, Country } 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';
|
|
@@ -1368,6 +1368,153 @@ declare function validateChannelScopeAssignment(entityId: string, channelId: str
|
|
|
1368
1368
|
*/
|
|
1369
1369
|
declare function assertEntityBelongsToChannel(entity: ChannelScopeable, expectedChannelId: string): void;
|
|
1370
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
|
+
|
|
1371
1518
|
/**
|
|
1372
1519
|
* Medusa provider configuration
|
|
1373
1520
|
*/
|
|
@@ -1459,6 +1606,18 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
1459
1606
|
* Only created when adminConfig.apiKey is provided.
|
|
1460
1607
|
*/
|
|
1461
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;
|
|
1462
1621
|
/** Cached distinct product status values — rarely changes, cached for process lifetime */
|
|
1463
1622
|
private _cachedProductStatuses;
|
|
1464
1623
|
/**
|
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, Country } 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';
|
|
@@ -1368,6 +1368,153 @@ declare function validateChannelScopeAssignment(entityId: string, channelId: str
|
|
|
1368
1368
|
*/
|
|
1369
1369
|
declare function assertEntityBelongsToChannel(entity: ChannelScopeable, expectedChannelId: string): void;
|
|
1370
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
|
+
|
|
1371
1518
|
/**
|
|
1372
1519
|
* Medusa provider configuration
|
|
1373
1520
|
*/
|
|
@@ -1459,6 +1606,18 @@ declare class MedusaProvider implements CommerceProvider {
|
|
|
1459
1606
|
* Only created when adminConfig.apiKey is provided.
|
|
1460
1607
|
*/
|
|
1461
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;
|
|
1462
1621
|
/** Cached distinct product status values — rarely changes, cached for process lifetime */
|
|
1463
1622
|
private _cachedProductStatuses;
|
|
1464
1623
|
/**
|