@thorprovider/types 7.7.0 → 7.9.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +18 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.mts +693 -10
- package/dist/index.d.ts +693 -10
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth.ts +20 -0
- package/src/cart.ts +75 -1
- package/src/checkout.ts +17 -0
- package/src/commerce-provider.ts +86 -10
- package/src/common.ts +33 -0
- package/src/index.ts +76 -0
- package/src/order.ts +688 -1
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @thorprovider/types v1.0\n * Shared TypeScript types for Thor Commerce ecosystem\n * \n * Pure type definitions with zero runtime dependencies.\n * Foundation for type-safe commerce operations following SOLID principles.\n */\n\n// ============================================\n// Common Types\n// ============================================\nexport type {\n Money,\n Image,\n SEO,\n Connection,\n Edge,\n PaginationOptions,\n SortOptions,\n Country,\n} from './common';\n\n// ============================================\n// Commerce Contracts (single-store context + guest shapes)\n// ============================================\nexport type {\n StoreContext,\n ShopperIdentity,\n CartSession,\n OrderReceipt,\n} from './commerce';\n\n// ============================================\n// Checkout Contracts (type-only)\n// ============================================\nexport type {\n CheckoutReadState,\n CheckoutAddressOption,\n CheckoutAddressLevel,\n CheckoutLocationOptions,\n CheckoutAddressValues,\n CheckoutContactValues,\n CheckoutCustomerIdentity,\n CheckoutSavedAddress,\n CheckoutShippingOption,\n CheckoutShippingGroup,\n CheckoutShippingGroupItem,\n CheckoutAdjustmentPayment,\n CheckoutInterruptionKind,\n CheckoutInterruptionAction,\n CheckoutInterruption,\n CheckoutSubmission,\n} from './checkout';\n\n// ============================================\n// Grouped Shipping Contracts (type-only)\n// ============================================\nexport type {\n ShippingGroupLocation,\n ShippingGroupOption,\n ShippingGroupItem,\n ShippingGroup,\n ShippingGroupQuote,\n ShippingGroupSelection,\n} from './shipping';\n\nexport type {\n AuthorConfig,\n BrandConfig,\n ModulesConfig,\n NavigationItem,\n SiteConfig,\n SocialConfig,\n} from './site-config';\n\nexport type { SiteConfigLabels } from './site-config-labels';\n\n// ============================================\n// Unified Query Types\n// ============================================\nexport type {\n QuerySortDirection,\n QueryEntityInput,\n QueryEntitiesInput,\n QueryMeta,\n QueryErrors,\n QueryResponse,\n} from './query';\n\n// ============================================\n// Catalog Query & Facet Support Types\n// ============================================\nexport type {\n CatalogSortKey,\n CatalogQuery,\n CatalogAppliedFilters,\n CatalogFacetId,\n CatalogFacetDemonstrationSource,\n FacetSupport,\n CatalogResults,\n CatalogQueryFailureCode,\n CatalogQueryFailureRepair,\n CatalogQueryFailure,\n CatalogQueryOutcome,\n} from './catalog';\n\n// ============================================\n// Product Types\n// ============================================\nexport type {\n Product,\n ProductOption,\n ProductVariant,\n SelectedOption,\n PriceRange,\n GetProductsOptions,\n ActiveFilter,\n SortOption,\n FilterSection,\n FilterOption,\n ProductPreview,\n Review,\n CompareProduct,\n AdminProductVariant,\n AdminProduct,\n AdvancedSearchProductsOptions,\n SearchResultMeta,\n FilterConfig,\n} from './product';\n\n// ============================================\n// Cart Types\n// ============================================\nexport type {\n Cart,\n CartItem,\n CartProduct,\n CartCost,\n CartLineInput,\n CartLineUpdate,\n ShippingMethod,\n DiscountCode,\n} from './cart';\n\n// ============================================\n// Inventory & Fulfillment Types\n// ============================================\nexport type {\n StockLocation,\n InventoryLevel,\n FulfillmentSet,\n FulfillmentOption,\n StockStatus,\n StockValidation,\n} from './stock-location';\n\n// ============================================\n// Collection Types\n// ============================================\nexport type {\n Collection,\n CollectionProductsOptions,\n GetCollectionsOptions,\n} from './collection';\n\n// ============================================\n// Category Types\n// ============================================\nexport type {\n ProductCategory,\n GetCategoriesOptions,\n GetCategoriesCallback,\n} from './category';\n\n// ============================================\n// Customer Types\n// ============================================\nexport type {\n Customer,\n Address,\n GetCustomersOptions,\n GetCustomersCallback,\n} from './customer';\n\n// ============================================\n// Region Types\n// ============================================\nexport type {\n Region,\n} from './region';\n\n// ============================================\n// Order Types\n// ============================================\nexport type {\n Order,\n OrderDeliveryGroup,\n OrderItem,\n OrderPayment,\n OrderPaymentStatus,\n OrderStatus,\n PaymentStatus,\n FulfillmentStatus,\n GetOrdersOptions,\n GetOrdersCallback,\n GetCustomerOrdersPageOptions,\n CustomerOrdersPage,\n} from './order';\n\n// ============================================\n// Provider Types (L1 - type-only)\n// Runtime provider registry lives in @thorprovider/adapters\n// ============================================\nexport type { ProviderTypeString } from './provider';\n\n// ============================================\n// Storefront Types\n// ============================================\nexport type {\n StorefrontContext,\n StorefrontPlatformType,\n} from './storefront';\n\n// ============================================\n// Storefront Configuration Types\n// ============================================\nexport type {\n StorefrontConfig,\n StorefrontSeoDefaults,\n} from './storefront-config';\n\n// ============================================\n// Designer Configuration Types\n// ============================================\nexport type {\n DesignerConfig,\n DesignerThemeConfig,\n DesignerThemePreset,\n DesignerNavItem,\n DesignerHistoryEntry,\n} from './designer-config';\n\n// ============================================\n// Auth Types\n// ============================================\nexport type {\n AuthProvider,\n AuthConfig,\n AuthMethod,\n AuthStorage,\n LoginCredentials,\n RegisterData,\n AuthResponse,\n UpdateCustomerData,\n CreateAddressData,\n PasswordResetRequest,\n PasswordResetConfirm,\n TokenVerifyState,\n TokenVerifyResult,\n RecoveryConfirmResult,\n SalesChannelType,\n InterestCategory,\n RequestedProfile,\n SubmitApplicationSalesChannel,\n SubmitApplicationBody,\n SubmitApplicationCreated,\n SubmitApplicationConflictApplication,\n SubmitApplicationResponse,\n SubmitApplicationResult,\n} from './auth';\n\n// ============================================\n// Payment Types\n// ============================================\nexport type {\n PaymentMethod,\n PaymentMethodType,\n PaymentMethodFeatures,\n PaymentMethodsOptions,\n CachedPaymentMethods,\n CheckoutCapturePolicy,\n CheckoutPaymentPlanItem,\n GiftCardValidationResult,\n StoreCreditAccountSummary,\n CheckoutPaymentSummary,\n CheckoutPaymentSummaryPayment,\n CheckoutPaymentSummaryStatus,\n} from './payment';\n\n// ============================================\n// Commerce Provider Interface\n// ============================================\nexport type {\n CommerceProvider,\n BackendCapabilities,\n ProviderConfig,\n} from './commerce-provider';\n\n// ============================================\n// Admin Types\n// ============================================\nexport type {\n AdminUser,\n AuditLog,\n DashboardConfig,\n DashboardMetrics,\n SalesMetrics,\n OrdersMetrics,\n ProductsMetrics,\n ChartDataPoint,\n DashboardMetricsAdapter,\n DashboardOrdersAdapter,\n DashboardProductsAdapter,\n AuditLogAdapter,\n SiteConfigMetadata,\n ConfigHistoryEntry,\n // Multi-tenant admin types\n AdminChannelCustomer,\n GetChannelCustomersResponse,\n GetChannelCustomersOptions,\n AdminApiKey,\n GetChannelApiKeysResponse,\n AdminChannelCategory,\n GetChannelCategoriesResponse,\n GetChannelCategoriesOptions,\n AdminSalesChannelRef,\n GetCategorySalesChannelsResponse,\n AssignCategoriesToChannelsBody,\n AssignCategoriesToChannelsResponse,\n UnassignCategoriesFromChannelsBody,\n UnassignCategoriesFromChannelsResponse,\n GetCollectionSalesChannelsResponse,\n AssignCollectionsToChannelsBody,\n AssignCollectionsToChannelsResponse,\n UnassignCollectionsFromChannelsBody,\n UnassignCollectionsFromChannelsResponse,\n AdminStorefrontSeoDefaults,\n AdminStorefrontConfig,\n GetAdminStorefrontConfigResponse,\n UpdateStorefrontConfigBody,\n UpdateStorefrontConfigResponse,\n AdminSiteConfigHistoryEntry,\n AdminSiteConfig,\n GetAdminSiteConfigResponse,\n UpdateSiteConfigBody,\n UpdateSiteConfigResponse,\n AdminSiteConfigHistoryEntryFull,\n GetAdminSiteConfigHistoryResponse,\n GetAdminSiteConfigHistoryOptions,\n RestoreSiteConfigResponse,\n LinkCustomerToChannelResponse,\n // Dropshipping types\n DropshipperAccountRef,\n DropshipperCostTier,\n DropshipperSaleTier,\n OnboardDropshipperBody,\n OnboardDropshipperResponse,\n DropshipperVariant,\n DropshipperProduct,\n DropshipperProductImage,\n DropshipperProductAttachment,\n DropshipperProductPrivateMedia,\n GetDropshipperProductsOptions,\n GetDropshipperProductsResponse,\n ValidateCheckoutItemsRequest,\n ValidatedCheckoutItem,\n ValidateCheckoutItemsResponse,\n UpdateDropshipperProductStatusBody,\n UpdateDropshipperProductStatusResponse,\n DropshipperPriceTier,\n DropshipperPriceItem,\n UpdateDropshipperPricesBody,\n UpdateDropshipperPricesResponse,\n DropshipperOrderCustomer,\n DropshipperOrder,\n GetDropshipperOrdersOptions,\n GetDropshipperOrdersResponse,\n DropshipperShippingOption,\n DropshipperShippingGroupOption,\n DropshipperShippingGroup,\n ShippingGroupInput,\n GetDropshipperShippingOptionsBody,\n GetDropshipperShippingOptionsResponse,\n DropshipperOrderShippingAddress,\n DropshipperOrderItem,\n DropshipperOrderTotals,\n DropshipperOrderTaxLine,\n DropshipperOrderTimelineEvent,\n DropshipperOrderDetail,\n GetDropshipperOrderDetailResponse,\n CreateOrderItem,\n CreateDropshipperOrderBody,\n CreateDropshipperOrderResponse,\n ExtendedCreateDropshipperOrderBody,\n ExtendedCreateDropshipperOrderResponse,\n SetPaymentCollectorBody,\n SetPaymentCollectorResponse,\n SetPaymentMethodBody,\n SetPaymentMethodResponse,\n ValidateGiftCardBody,\n ValidateGiftCardResponse,\n DropshipperCategory,\n GetDropshipperCategoriesOptions,\n GetDropshipperCategoriesResponse,\n CreateDropshipperCategoryBody,\n UpdateDropshipperCategoryBody,\n DeleteDropshipperCategoryResponse,\n ProviderCategory,\n GetProviderCategoriesResponse,\n GetCategoryMappingsOptions,\n CategoryMapping,\n GetCategoryMappingsResponse,\n CreateCategoryMappingBody,\n CreateCategoryMappingResponse,\n DeleteCategoryMappingResponse,\n DropshipperCustomer,\n DropshipperCustomerStats,\n DropshipperCustomerFinancial,\n DropshipperCustomerAddress,\n DropshipperCustomerDetail,\n GetDropshipperCustomersOptions,\n GetDropshipperCustomersResponse,\n GetDropshipperCustomerDetailResponse,\n CreateDropshipperCustomerBody,\n CreateDropshipperCustomerResponse,\n UpdateDropshipperCustomerBody,\n UpdateDropshipperCustomerResponse,\n DropshipperBalance,\n DropshipperPendingOrders,\n DropshipperPaymentMethodConfig,\n DropshipperAccount,\n GetDropshipperAccountResponse,\n DropshipperPayableOrder,\n GetDropshipperPayableResponse,\n DropshipperReceivableOrder,\n GetDropshipperReceivableResponse,\n SettlementRecord,\n GetSettlementsOptions,\n GetSettlementsResponse,\n GetSettlementDetailResponse,\n CreateSettlementBody,\n CreateSettlementResponse,\n ConfirmSettlementBody,\n CancelSettlementBody,\n UpdateSettlementStatusResponse,\n AdminDropshipperAccount,\n AdminDropshipperBalance,\n GetAdminDropshipperAccountsResponse,\n GetAdminAccountBalanceResponse,\n GetAdminPriceListsResponse,\n GetUserChannelResponse,\n DropshipperPromotion,\n GetDropshipperPromotionsOptions,\n GetDropshipperPromotionsResponse,\n PromotionRule,\n CreateDropshipperPromotionBody,\n UpdateDropshipperPromotionBody,\n DeleteDropshipperPromotionResponse,\n GetDashboardStatsOptions,\n DashboardPeriodMetrics,\n DashboardChanges,\n DashboardTopProduct,\n DashboardStats,\n GetDashboardStatsResponse,\n GetStorefrontDropshipperCategoriesResponse,\n OrderNote,\n CreateOrderNoteBody,\n GetOrderNotesResponse,\n CreateOrderNoteResponse,\n DeleteOrderNoteResponse,\n // Order cancel and edits\n CancelDropshipperOrderResponse,\n CreateOrderEditBody,\n CreateOrderEditResponse,\n AddOrderEditItemBody,\n AddOrderEditItemResponse,\n ConfirmOrderEditResponse,\n // Draft Orders\n DropshipperDraftOrderItem,\n DropshipperDraftOrder,\n GetDropshipperDraftOrdersOptions,\n GetDropshipperDraftOrdersResponse,\n CreateDropshipperDraftOrderBody,\n CreateDropshipperDraftOrderResponse,\n GetDropshipperDraftOrderDetailResponse,\n UpdateDropshipperDraftOrderBody,\n UpdateDropshipperDraftOrderResponse,\n ConvertDropshipperDraftOrderBody,\n ConvertDropshipperDraftOrderResponse,\n DeleteDropshipperDraftOrderResponse,\n // Order totals preview\n PreviewDropshipperOrderItem,\n PreviewDropshipperOrderTotalsBody,\n PreviewDropshipperOrderTotalsResponse,\n // Dropshipper addresses (channel-scoped)\n DropshipperAddressBody,\n DropshipperAddressResponse,\n GetDropshipperAddressesResponse,\n // Financial Endpoints — Group A\n SettlementStatus,\n GetDropshipperAccountBalanceResponse,\n GetDropshipperAccountOrdersOptions,\n GetDropshipperAccountOrdersResponse,\n GetAdminDropshipperAccountOrdersResponse,\n GetAdminDropshipperAccountSettlementsOptions,\n GetAdminDropshipperAccountSettlementsResponse,\n ResolveGuaranteeBody,\n ResolveGuaranteeResponse,\n CreateCompensacionBody,\n CreateCompensacionResponse,\n CreateAjusteBody,\n CreateAjusteResponse,\n // Financial Endpoints — Group B\n CreateCobroBody,\n CreateCobroResponse,\n CreatePagoBody,\n CreatePagoResponse,\n CreateReversoBody,\n CreateReversoResponse,\n ConfirmMovementBody,\n ConfirmMovementResponse,\n CancelMovementBody,\n CancelMovementResponse,\n GetFinancialAnalysisResponse,\n RegisterPaymentBody,\n RegisterPaymentResponse,\n // Dashboard Capabilities\n DropshipperDashboardCapabilities,\n // AI Assistant Chat\n ChatMessage,\n ChatRequest,\n ChatIntent,\n ChatSource,\n ChatSourceVariant,\n ChatResponse,\n ChatAssistantHealthResponse,\n // Geo-reference\n GeoCountry,\n GeoProvince,\n GeoCity,\n GetGeoCountriesResponse,\n GetGeoProvincesResponse,\n GetGeoCitiesResponse,\n // Product Attributes\n DropshipperProductAttribute,\n DropshipperProductAttributeValue,\n GetProductAttributesResponse,\n DropshipperAttributeDefinition,\n DropshipperAttributeDefinitionValue,\n GetDropshipperAttributesResponse,\n DropshipperProductOption,\n DropshipperProductOptionValue,\n // Dropshipper Profile\n DropshipperProfile,\n GetMyProfileResponse,\n // Cost Price Changes Detection\n CostPriceChangesCheckResponse,\n CostPriceChangeItem,\n CostPriceChangesResponse,\n AcknowledgeCostPriceChangesResponse,\n // Notifications\n NotificationData,\n PriceUpdatedNotificationData,\n ProductAssignedNotificationData,\n StockChangeNotificationData,\n ManualAdminNotificationData,\n RawNotification,\n GetNotificationsOptions,\n GetNotificationsResponse,\n // Notification preferences\n DropshipperNotificationEventType,\n DropshipperNotificationPreference,\n UpdateNotificationPreferencesBody,\n GetNotificationPreferencesResponse,\n } from './admin';\n\n// ============================================\n// Dropshipper Business Policy Types\n// ============================================\nexport type {\n GetBusinessPolicyResponse,\n UpdateBusinessPolicyBody,\n UpdateBusinessPolicyResponse,\n} from './dropshipper-business-policy';\n\n// ============================================\n// Header Configuration Types\n// ============================================\nexport type {\n IconConfig,\n NavigationCalloutItem,\n NavigationLinkItem,\n DynamicSource,\n HeaderLinkItem,\n AccountMenuItem,\n AccountDropdownConfig,\n SearchBarConfig,\n HeaderNavigationConfig,\n} from './header-config';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["/**\n * @thorprovider/types v1.0\n * Shared TypeScript types for Thor Commerce ecosystem\n * \n * Pure type definitions with zero runtime dependencies.\n * Foundation for type-safe commerce operations following SOLID principles.\n */\n\n// ============================================\n// Common Types\n// ============================================\nexport type {\n Money,\n Image,\n SEO,\n Connection,\n Edge,\n PaginationOptions,\n SortOptions,\n Country,\n PromotionKind,\n PromotionScope,\n PromotionSummary,\n} from './common';\n\n// ============================================\n// Commerce Contracts (single-store context + guest shapes)\n// ============================================\nexport type {\n StoreContext,\n ShopperIdentity,\n CartSession,\n OrderReceipt,\n} from './commerce';\n\n// ============================================\n// Checkout Contracts (type-only)\n// ============================================\nexport type {\n CheckoutReadState,\n CheckoutAddressOption,\n CheckoutAddressLevel,\n CheckoutLocationOptions,\n CheckoutAddressValues,\n CheckoutContactValues,\n GuestContact,\n CheckoutGuestContact,\n CheckoutCustomerIdentity,\n CheckoutSavedAddress,\n CheckoutShippingOption,\n CheckoutShippingGroup,\n CheckoutShippingGroupItem,\n CheckoutAdjustmentPayment,\n CheckoutInterruptionKind,\n CheckoutInterruptionAction,\n CheckoutInterruption,\n CheckoutSubmission,\n} from './checkout';\n\n// ============================================\n// Grouped Shipping Contracts (type-only)\n// ============================================\nexport type {\n ShippingGroupLocation,\n ShippingGroupOption,\n ShippingGroupItem,\n ShippingGroup,\n ShippingGroupQuote,\n ShippingGroupSelection,\n} from './shipping';\n\nexport type {\n AuthorConfig,\n BrandConfig,\n ModulesConfig,\n NavigationItem,\n SiteConfig,\n SocialConfig,\n} from './site-config';\n\nexport type { SiteConfigLabels } from './site-config-labels';\n\n// ============================================\n// Unified Query Types\n// ============================================\nexport type {\n QuerySortDirection,\n QueryEntityInput,\n QueryEntitiesInput,\n QueryMeta,\n QueryErrors,\n QueryResponse,\n} from './query';\n\n// ============================================\n// Catalog Query & Facet Support Types\n// ============================================\nexport type {\n CatalogSortKey,\n CatalogQuery,\n CatalogAppliedFilters,\n CatalogFacetId,\n CatalogFacetDemonstrationSource,\n FacetSupport,\n CatalogResults,\n CatalogQueryFailureCode,\n CatalogQueryFailureRepair,\n CatalogQueryFailure,\n CatalogQueryOutcome,\n} from './catalog';\n\n// ============================================\n// Product Types\n// ============================================\nexport type {\n Product,\n ProductOption,\n ProductVariant,\n SelectedOption,\n PriceRange,\n GetProductsOptions,\n ActiveFilter,\n SortOption,\n FilterSection,\n FilterOption,\n ProductPreview,\n Review,\n CompareProduct,\n AdminProductVariant,\n AdminProduct,\n AdvancedSearchProductsOptions,\n SearchResultMeta,\n FilterConfig,\n} from './product';\n\n// ============================================\n// Cart Types\n// ============================================\nexport type {\n Cart,\n CartItem,\n CartProduct,\n CartCost,\n CartLineInput,\n CartLineUpdate,\n ShippingMethod,\n DiscountCode,\n PriceTier,\n CheckoutLineProjection,\n CheckoutLineProjectionLine,\n} from './cart';\n\n// ============================================\n// Inventory & Fulfillment Types\n// ============================================\nexport type {\n StockLocation,\n InventoryLevel,\n FulfillmentSet,\n FulfillmentOption,\n StockStatus,\n StockValidation,\n} from './stock-location';\n\n// ============================================\n// Collection Types\n// ============================================\nexport type {\n Collection,\n CollectionProductsOptions,\n GetCollectionsOptions,\n} from './collection';\n\n// ============================================\n// Category Types\n// ============================================\nexport type {\n ProductCategory,\n GetCategoriesOptions,\n GetCategoriesCallback,\n} from './category';\n\n// ============================================\n// Customer Types\n// ============================================\nexport type {\n Customer,\n Address,\n GetCustomersOptions,\n GetCustomersCallback,\n} from './customer';\n\n// ============================================\n// Region Types\n// ============================================\nexport type {\n Region,\n} from './region';\n\n// ============================================\n// Order Types\n// ============================================\nexport type {\n Order,\n OrderDeliveryGroup,\n OrderItem,\n OrderPayment,\n OrderPaymentStatus,\n OrderStatus,\n PaymentStatus,\n FulfillmentStatus,\n GetOrdersOptions,\n GetOrdersCallback,\n GetCustomerOrdersPageOptions,\n CustomerOrdersPage,\n CustomerOrderAction,\n CustomerOrderPaymentStatus,\n CustomerOrderFulfillmentStatus,\n CustomerOrderFulfillmentItemStatus,\n CustomerOrderHistoryQuick,\n CustomerOrderHistorySort,\n CustomerOrderHistoryDatePreset,\n CustomerOrderHistoryCommercialStatus,\n CustomerOrderHistoryCommercialFilter,\n CustomerOrderHistoryPaymentFilter,\n CustomerOrderHistoryRefundFilter,\n CustomerOrderHistoryFulfilmentFilter,\n CustomerOrderHistoryDeliveryMode,\n CustomerOrderHistoryReturnStatus,\n CustomerOrderHistoryFilters,\n CustomerOrderHistoryQuery,\n CustomerOrderHistoryOptions,\n CustomerOrderHistoryShipment,\n CustomerOrderHistoryRecord,\n CustomerOrderHistoryPage,\n CustomerOrderDetail,\n CustomerOrderDetailAction,\n CustomerOrderDetailAdjustment,\n CustomerOrderDetailAdjustmentDirection,\n CustomerOrderDetailAdjustmentScope,\n CustomerOrderDetailAdjustmentSource,\n CustomerOrderDetailAllocation,\n CustomerOrderDetailApprovalStatus,\n CustomerOrderDetailAttachment,\n CustomerOrderDetailAttribute,\n CustomerOrderDetailAttributeKind,\n CustomerOrderDetailBusiness,\n CustomerOrderDetailCase,\n CustomerOrderDetailCaseLine,\n CustomerOrderDetailCaseStatus,\n CustomerOrderDetailCaseType,\n CustomerOrderDetailDocument,\n CustomerOrderDetailDocumentKind,\n CustomerOrderDetailFulfillment,\n CustomerOrderDetailFulfillmentItemStatus,\n CustomerOrderDetailFulfillmentStatus,\n CustomerOrderDetailGroup,\n CustomerOrderDetailInvoiceStatus,\n CustomerOrderDetailIssue,\n CustomerOrderDetailLine,\n CustomerOrderDetailLinePrice,\n CustomerOrderDetailOrder,\n CustomerOrderDetailPackage,\n CustomerOrderDetailPaymentStatus,\n CustomerOrderDetailPickup,\n CustomerOrderDetailPickupStatus,\n CustomerOrderDetailPriceKind,\n CustomerOrderDetailProductKind,\n CustomerOrderDetailPromotion,\n CustomerOrderDetailPromotionApplication,\n CustomerOrderDetailPromotionNominal,\n CustomerOrderDetailPromotionScope,\n CustomerOrderDetailRevision,\n CustomerOrderDetailRevisionKind,\n CustomerOrderDetailSection,\n CustomerOrderDetailShippingMethod,\n CustomerOrderDetailSnapshot,\n CustomerOrderDetailTaxLine,\n CustomerOrderDetailTotals,\n CustomerOrderDetailTransaction,\n CustomerOrderDetailTransactionKind,\n CustomerOrderDetailTransactionMethod,\n CustomerOrderDetailTransactionStatus,\n} from './order';\n\n// ============================================\n// Provider Types (L1 - type-only)\n// Runtime provider registry lives in @thorprovider/adapters\n// ============================================\nexport type { ProviderTypeString } from './provider';\n\n// ============================================\n// Storefront Types\n// ============================================\nexport type {\n StorefrontContext,\n StorefrontPlatformType,\n} from './storefront';\n\n// ============================================\n// Storefront Configuration Types\n// ============================================\nexport type {\n StorefrontConfig,\n StorefrontSeoDefaults,\n} from './storefront-config';\n\n// ============================================\n// Designer Configuration Types\n// ============================================\nexport type {\n DesignerConfig,\n DesignerThemeConfig,\n DesignerThemePreset,\n DesignerNavItem,\n DesignerHistoryEntry,\n} from './designer-config';\n\n// ============================================\n// Auth Types\n// ============================================\nexport type {\n AuthProvider,\n AuthConfig,\n AuthMethod,\n AuthStorage,\n LoginCredentials,\n RegisterData,\n AuthResponse,\n UpdateCustomerData,\n CreateAddressData,\n PasswordResetRequest,\n PasswordResetConfirm,\n TokenVerifyState,\n TokenVerifyResult,\n RecoveryConfirmResult,\n SalesChannelType,\n InterestCategory,\n RequestedProfile,\n SubmitApplicationSalesChannel,\n SubmitApplicationBody,\n SubmitApplicationCreated,\n SubmitApplicationConflictApplication,\n SubmitApplicationResponse,\n SubmitApplicationResult,\n} from './auth';\n\n// ============================================\n// Payment Types\n// ============================================\nexport type {\n PaymentMethod,\n PaymentMethodType,\n PaymentMethodFeatures,\n PaymentMethodsOptions,\n CachedPaymentMethods,\n CheckoutCapturePolicy,\n CheckoutPaymentPlanItem,\n GiftCardValidationResult,\n StoreCreditAccountSummary,\n CheckoutPaymentSummary,\n CheckoutPaymentSummaryPayment,\n CheckoutPaymentSummaryStatus,\n} from './payment';\n\n// ============================================\n// Commerce Provider Interface\n// ============================================\nexport type {\n CommerceProvider,\n BackendCapabilities,\n ProviderConfig,\n} from './commerce-provider';\n\n// ============================================\n// Admin Types\n// ============================================\nexport type {\n AdminUser,\n AuditLog,\n DashboardConfig,\n DashboardMetrics,\n SalesMetrics,\n OrdersMetrics,\n ProductsMetrics,\n ChartDataPoint,\n DashboardMetricsAdapter,\n DashboardOrdersAdapter,\n DashboardProductsAdapter,\n AuditLogAdapter,\n SiteConfigMetadata,\n ConfigHistoryEntry,\n // Multi-tenant admin types\n AdminChannelCustomer,\n GetChannelCustomersResponse,\n GetChannelCustomersOptions,\n AdminApiKey,\n GetChannelApiKeysResponse,\n AdminChannelCategory,\n GetChannelCategoriesResponse,\n GetChannelCategoriesOptions,\n AdminSalesChannelRef,\n GetCategorySalesChannelsResponse,\n AssignCategoriesToChannelsBody,\n AssignCategoriesToChannelsResponse,\n UnassignCategoriesFromChannelsBody,\n UnassignCategoriesFromChannelsResponse,\n GetCollectionSalesChannelsResponse,\n AssignCollectionsToChannelsBody,\n AssignCollectionsToChannelsResponse,\n UnassignCollectionsFromChannelsBody,\n UnassignCollectionsFromChannelsResponse,\n AdminStorefrontSeoDefaults,\n AdminStorefrontConfig,\n GetAdminStorefrontConfigResponse,\n UpdateStorefrontConfigBody,\n UpdateStorefrontConfigResponse,\n AdminSiteConfigHistoryEntry,\n AdminSiteConfig,\n GetAdminSiteConfigResponse,\n UpdateSiteConfigBody,\n UpdateSiteConfigResponse,\n AdminSiteConfigHistoryEntryFull,\n GetAdminSiteConfigHistoryResponse,\n GetAdminSiteConfigHistoryOptions,\n RestoreSiteConfigResponse,\n LinkCustomerToChannelResponse,\n // Dropshipping types\n DropshipperAccountRef,\n DropshipperCostTier,\n DropshipperSaleTier,\n OnboardDropshipperBody,\n OnboardDropshipperResponse,\n DropshipperVariant,\n DropshipperProduct,\n DropshipperProductImage,\n DropshipperProductAttachment,\n DropshipperProductPrivateMedia,\n GetDropshipperProductsOptions,\n GetDropshipperProductsResponse,\n ValidateCheckoutItemsRequest,\n ValidatedCheckoutItem,\n ValidateCheckoutItemsResponse,\n UpdateDropshipperProductStatusBody,\n UpdateDropshipperProductStatusResponse,\n DropshipperPriceTier,\n DropshipperPriceItem,\n UpdateDropshipperPricesBody,\n UpdateDropshipperPricesResponse,\n DropshipperOrderCustomer,\n DropshipperOrder,\n GetDropshipperOrdersOptions,\n GetDropshipperOrdersResponse,\n DropshipperShippingOption,\n DropshipperShippingGroupOption,\n DropshipperShippingGroup,\n ShippingGroupInput,\n GetDropshipperShippingOptionsBody,\n GetDropshipperShippingOptionsResponse,\n DropshipperOrderShippingAddress,\n DropshipperOrderItem,\n DropshipperOrderTotals,\n DropshipperOrderTaxLine,\n DropshipperOrderTimelineEvent,\n DropshipperOrderDetail,\n GetDropshipperOrderDetailResponse,\n CreateOrderItem,\n CreateDropshipperOrderBody,\n CreateDropshipperOrderResponse,\n ExtendedCreateDropshipperOrderBody,\n ExtendedCreateDropshipperOrderResponse,\n SetPaymentCollectorBody,\n SetPaymentCollectorResponse,\n SetPaymentMethodBody,\n SetPaymentMethodResponse,\n ValidateGiftCardBody,\n ValidateGiftCardResponse,\n DropshipperCategory,\n GetDropshipperCategoriesOptions,\n GetDropshipperCategoriesResponse,\n CreateDropshipperCategoryBody,\n UpdateDropshipperCategoryBody,\n DeleteDropshipperCategoryResponse,\n ProviderCategory,\n GetProviderCategoriesResponse,\n GetCategoryMappingsOptions,\n CategoryMapping,\n GetCategoryMappingsResponse,\n CreateCategoryMappingBody,\n CreateCategoryMappingResponse,\n DeleteCategoryMappingResponse,\n DropshipperCustomer,\n DropshipperCustomerStats,\n DropshipperCustomerFinancial,\n DropshipperCustomerAddress,\n DropshipperCustomerDetail,\n GetDropshipperCustomersOptions,\n GetDropshipperCustomersResponse,\n GetDropshipperCustomerDetailResponse,\n CreateDropshipperCustomerBody,\n CreateDropshipperCustomerResponse,\n UpdateDropshipperCustomerBody,\n UpdateDropshipperCustomerResponse,\n DropshipperBalance,\n DropshipperPendingOrders,\n DropshipperPaymentMethodConfig,\n DropshipperAccount,\n GetDropshipperAccountResponse,\n DropshipperPayableOrder,\n GetDropshipperPayableResponse,\n DropshipperReceivableOrder,\n GetDropshipperReceivableResponse,\n SettlementRecord,\n GetSettlementsOptions,\n GetSettlementsResponse,\n GetSettlementDetailResponse,\n CreateSettlementBody,\n CreateSettlementResponse,\n ConfirmSettlementBody,\n CancelSettlementBody,\n UpdateSettlementStatusResponse,\n AdminDropshipperAccount,\n AdminDropshipperBalance,\n GetAdminDropshipperAccountsResponse,\n GetAdminAccountBalanceResponse,\n GetAdminPriceListsResponse,\n GetUserChannelResponse,\n DropshipperPromotion,\n GetDropshipperPromotionsOptions,\n GetDropshipperPromotionsResponse,\n PromotionRule,\n CreateDropshipperPromotionBody,\n UpdateDropshipperPromotionBody,\n DeleteDropshipperPromotionResponse,\n GetDashboardStatsOptions,\n DashboardPeriodMetrics,\n DashboardChanges,\n DashboardTopProduct,\n DashboardStats,\n GetDashboardStatsResponse,\n GetStorefrontDropshipperCategoriesResponse,\n OrderNote,\n CreateOrderNoteBody,\n GetOrderNotesResponse,\n CreateOrderNoteResponse,\n DeleteOrderNoteResponse,\n // Order cancel and edits\n CancelDropshipperOrderResponse,\n CreateOrderEditBody,\n CreateOrderEditResponse,\n AddOrderEditItemBody,\n AddOrderEditItemResponse,\n ConfirmOrderEditResponse,\n // Draft Orders\n DropshipperDraftOrderItem,\n DropshipperDraftOrder,\n GetDropshipperDraftOrdersOptions,\n GetDropshipperDraftOrdersResponse,\n CreateDropshipperDraftOrderBody,\n CreateDropshipperDraftOrderResponse,\n GetDropshipperDraftOrderDetailResponse,\n UpdateDropshipperDraftOrderBody,\n UpdateDropshipperDraftOrderResponse,\n ConvertDropshipperDraftOrderBody,\n ConvertDropshipperDraftOrderResponse,\n DeleteDropshipperDraftOrderResponse,\n // Order totals preview\n PreviewDropshipperOrderItem,\n PreviewDropshipperOrderTotalsBody,\n PreviewDropshipperOrderTotalsResponse,\n // Dropshipper addresses (channel-scoped)\n DropshipperAddressBody,\n DropshipperAddressResponse,\n GetDropshipperAddressesResponse,\n // Financial Endpoints — Group A\n SettlementStatus,\n GetDropshipperAccountBalanceResponse,\n GetDropshipperAccountOrdersOptions,\n GetDropshipperAccountOrdersResponse,\n GetAdminDropshipperAccountOrdersResponse,\n GetAdminDropshipperAccountSettlementsOptions,\n GetAdminDropshipperAccountSettlementsResponse,\n ResolveGuaranteeBody,\n ResolveGuaranteeResponse,\n CreateCompensacionBody,\n CreateCompensacionResponse,\n CreateAjusteBody,\n CreateAjusteResponse,\n // Financial Endpoints — Group B\n CreateCobroBody,\n CreateCobroResponse,\n CreatePagoBody,\n CreatePagoResponse,\n CreateReversoBody,\n CreateReversoResponse,\n ConfirmMovementBody,\n ConfirmMovementResponse,\n CancelMovementBody,\n CancelMovementResponse,\n GetFinancialAnalysisResponse,\n RegisterPaymentBody,\n RegisterPaymentResponse,\n // Dashboard Capabilities\n DropshipperDashboardCapabilities,\n // AI Assistant Chat\n ChatMessage,\n ChatRequest,\n ChatIntent,\n ChatSource,\n ChatSourceVariant,\n ChatResponse,\n ChatAssistantHealthResponse,\n // Geo-reference\n GeoCountry,\n GeoProvince,\n GeoCity,\n GetGeoCountriesResponse,\n GetGeoProvincesResponse,\n GetGeoCitiesResponse,\n // Product Attributes\n DropshipperProductAttribute,\n DropshipperProductAttributeValue,\n GetProductAttributesResponse,\n DropshipperAttributeDefinition,\n DropshipperAttributeDefinitionValue,\n GetDropshipperAttributesResponse,\n DropshipperProductOption,\n DropshipperProductOptionValue,\n // Dropshipper Profile\n DropshipperProfile,\n GetMyProfileResponse,\n // Cost Price Changes Detection\n CostPriceChangesCheckResponse,\n CostPriceChangeItem,\n CostPriceChangesResponse,\n AcknowledgeCostPriceChangesResponse,\n // Notifications\n NotificationData,\n PriceUpdatedNotificationData,\n ProductAssignedNotificationData,\n StockChangeNotificationData,\n ManualAdminNotificationData,\n RawNotification,\n GetNotificationsOptions,\n GetNotificationsResponse,\n // Notification preferences\n DropshipperNotificationEventType,\n DropshipperNotificationPreference,\n UpdateNotificationPreferencesBody,\n GetNotificationPreferencesResponse,\n } from './admin';\n\n// ============================================\n// Dropshipper Business Policy Types\n// ============================================\nexport type {\n GetBusinessPolicyResponse,\n UpdateBusinessPolicyBody,\n UpdateBusinessPolicyResponse,\n} from './dropshipper-business-policy';\n\n// ============================================\n// Header Configuration Types\n// ============================================\nexport type {\n IconConfig,\n NavigationCalloutItem,\n NavigationLinkItem,\n DynamicSource,\n HeaderLinkItem,\n AccountMenuItem,\n AccountDropdownConfig,\n SearchBarConfig,\n HeaderNavigationConfig,\n} from './header-config';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
package/package.json
CHANGED
package/src/auth.ts
CHANGED
|
@@ -352,6 +352,26 @@ export interface AuthProvider {
|
|
|
352
352
|
*/
|
|
353
353
|
resetPassword(token: string, password: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
354
354
|
|
|
355
|
+
/**
|
|
356
|
+
* Request a verification code for the authenticated customer's email.
|
|
357
|
+
* Optional: providers that cannot verify omit it, and their
|
|
358
|
+
* `BackendCapabilities.verifyEmail` stays false.
|
|
359
|
+
*/
|
|
360
|
+
requestEmailVerification?(): Promise<void>;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Verify the authenticated customer's email with a provider-issued code.
|
|
364
|
+
* Optional, paired with `requestEmailVerification`.
|
|
365
|
+
*/
|
|
366
|
+
verifyEmail?(code: string): Promise<void>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Check a reset code without consuming it, so a multi-step form can keep the
|
|
370
|
+
* shopper on the code step. Optional: providers without it validate the code
|
|
371
|
+
* only when `resetPassword` runs.
|
|
372
|
+
*/
|
|
373
|
+
verifyPasswordResetCode?(code: string): Promise<boolean>;
|
|
374
|
+
|
|
355
375
|
// ========================================
|
|
356
376
|
// Session Management
|
|
357
377
|
// ========================================
|
package/src/cart.ts
CHANGED
|
@@ -3,10 +3,48 @@
|
|
|
3
3
|
* Cart types - unified interface for all commerce providers
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { Image, Money } from './common';
|
|
6
|
+
import type { Image, Money, PromotionSummary } from './common';
|
|
7
|
+
import type { GuestContact } from './checkout';
|
|
7
8
|
import type { SelectedOption } from './product';
|
|
8
9
|
import type { FulfillmentOption, StockStatus, StockValidation } from './stock-location';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* One quantity-price tier for a cart line.
|
|
13
|
+
*
|
|
14
|
+
* `maxQuantity` is absent for an open-ended tier. The unit price is the
|
|
15
|
+
* backend's effective price for that range; consumers render it and never
|
|
16
|
+
* derive it from a percentage or a configured amount.
|
|
17
|
+
*/
|
|
18
|
+
export interface PriceTier {
|
|
19
|
+
minQuantity: number;
|
|
20
|
+
maxQuantity?: number;
|
|
21
|
+
unitPrice: Money;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Per-line checkout projection: stock and the effective quantity-price ladder.
|
|
26
|
+
*
|
|
27
|
+
* `availableQuantity` is the maximum number of complete units a single
|
|
28
|
+
* sales-channel warehouse can serve, never the sum across warehouses.
|
|
29
|
+
* `basePrice` is the effective group's base price when the backend reports one;
|
|
30
|
+
* `tiers` is the quantity ladder. Both are omitted/empty when the backend does
|
|
31
|
+
* not expose them.
|
|
32
|
+
*/
|
|
33
|
+
export interface CheckoutLineProjectionLine {
|
|
34
|
+
lineId: string;
|
|
35
|
+
variantId: string;
|
|
36
|
+
availableQuantity?: number;
|
|
37
|
+
stockStatus?: StockStatus;
|
|
38
|
+
locationId?: string;
|
|
39
|
+
basePrice?: Money;
|
|
40
|
+
tiers: PriceTier[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface CheckoutLineProjection {
|
|
44
|
+
lines: CheckoutLineProjectionLine[];
|
|
45
|
+
stockValidation: StockValidation;
|
|
46
|
+
}
|
|
47
|
+
|
|
10
48
|
/**
|
|
11
49
|
* Product reference in cart
|
|
12
50
|
*/
|
|
@@ -24,6 +62,15 @@ export interface CartItem {
|
|
|
24
62
|
id: string | undefined;
|
|
25
63
|
quantity: number;
|
|
26
64
|
stockStatus?: StockStatus;
|
|
65
|
+
/**
|
|
66
|
+
* Maximum complete units a single sales-channel warehouse can serve, when
|
|
67
|
+
* the backend exposes stock. Absent for unmanaged inventory or backorder.
|
|
68
|
+
*/
|
|
69
|
+
availableQuantity?: number;
|
|
70
|
+
/** Effective quantity-price ladder, when the backend exposes one. */
|
|
71
|
+
tiers?: PriceTier[];
|
|
72
|
+
/** Effective price group's base price, when the backend reports one. */
|
|
73
|
+
basePrice?: Money;
|
|
27
74
|
cost: {
|
|
28
75
|
totalAmount: Money;
|
|
29
76
|
/**
|
|
@@ -120,6 +167,28 @@ export interface Cart {
|
|
|
120
167
|
* cart that belongs to another shopper.
|
|
121
168
|
*/
|
|
122
169
|
customerId?: string;
|
|
170
|
+
/**
|
|
171
|
+
* Contact email stored on the cart.
|
|
172
|
+
*
|
|
173
|
+
* For a guest checkout the backend copies it to the order and uses it for the
|
|
174
|
+
* confirmation email. It is the authoritative contact email; the name and
|
|
175
|
+
* phone live in `guestContact`.
|
|
176
|
+
*/
|
|
177
|
+
email?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Whether the cart's customer is a registered account (`has_account=true`).
|
|
180
|
+
*
|
|
181
|
+
* A guest customer created natively by Medusa has `has_account=false`; the
|
|
182
|
+
* runtime uses this flag to exclude registered-only instruments such as store
|
|
183
|
+
* credit.
|
|
184
|
+
*/
|
|
185
|
+
customerHasAccount?: boolean;
|
|
186
|
+
/**
|
|
187
|
+
* Guest contact carried in `cart.metadata.guest_contact`.
|
|
188
|
+
*
|
|
189
|
+
* Never written to the Customer record; the order inherits the metadata.
|
|
190
|
+
*/
|
|
191
|
+
guestContact?: GuestContact;
|
|
123
192
|
/** Backend id of the applied shipping method, when one is selected. */
|
|
124
193
|
selectedShippingMethodId?: string;
|
|
125
194
|
/**
|
|
@@ -130,6 +199,11 @@ export interface Cart {
|
|
|
130
199
|
* (the applied shipping-method record id). Absent when no method is applied.
|
|
131
200
|
*/
|
|
132
201
|
selectedShippingOptionId?: string;
|
|
202
|
+
/**
|
|
203
|
+
* One row per promotion resolved from the backend's adjustments. Absent when
|
|
204
|
+
* the provider does not expose a promotion breakdown.
|
|
205
|
+
*/
|
|
206
|
+
promotions?: PromotionSummary[];
|
|
133
207
|
/** Platform-specific backend metadata, carried through unchanged. */
|
|
134
208
|
metadata?: Record<string, unknown>;
|
|
135
209
|
}
|
package/src/checkout.ts
CHANGED
|
@@ -62,6 +62,23 @@ export interface CheckoutContactValues {
|
|
|
62
62
|
phone: string;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Guest contact stored on the cart/order (never on the Customer record).
|
|
67
|
+
*
|
|
68
|
+
* The email is authoritative on `Cart.email`; this shape carries the display
|
|
69
|
+
* name and phone the shopper entered for the order.
|
|
70
|
+
*/
|
|
71
|
+
export interface GuestContact {
|
|
72
|
+
firstName: string;
|
|
73
|
+
lastName: string;
|
|
74
|
+
phone: string;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** Guest contact payload accepted by the checkout contact route. */
|
|
78
|
+
export interface CheckoutGuestContact extends GuestContact {
|
|
79
|
+
email: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
65
82
|
/** Authenticated identity mapped by the host. No token or raw customer object. */
|
|
66
83
|
export interface CheckoutCustomerIdentity {
|
|
67
84
|
id: string;
|
package/src/commerce-provider.ts
CHANGED
|
@@ -20,6 +20,7 @@ import type {
|
|
|
20
20
|
Cart,
|
|
21
21
|
CartLineInput,
|
|
22
22
|
CartLineUpdate,
|
|
23
|
+
CheckoutLineProjection,
|
|
23
24
|
ShippingMethod
|
|
24
25
|
} from './cart';
|
|
25
26
|
import type {
|
|
@@ -37,6 +38,9 @@ import type {
|
|
|
37
38
|
GetOrdersOptions,
|
|
38
39
|
GetCustomerOrdersPageOptions,
|
|
39
40
|
CustomerOrdersPage,
|
|
41
|
+
CustomerOrderHistoryOptions,
|
|
42
|
+
CustomerOrderHistoryPage,
|
|
43
|
+
CustomerOrderDetailSnapshot,
|
|
40
44
|
} from './order';
|
|
41
45
|
import type { Region } from './region';
|
|
42
46
|
import type {
|
|
@@ -45,6 +49,7 @@ import type {
|
|
|
45
49
|
GiftCardValidationResult,
|
|
46
50
|
StoreCreditAccountSummary,
|
|
47
51
|
} from './payment';
|
|
52
|
+
import type { CheckoutGuestContact } from './checkout';
|
|
48
53
|
import type { AuthProvider } from './auth';
|
|
49
54
|
import type { StorefrontContext } from './storefront';
|
|
50
55
|
import type { StockLocation, InventoryLevel, StockValidation, FulfillmentOption } from './stock-location';
|
|
@@ -90,6 +95,9 @@ export interface BackendCapabilities {
|
|
|
90
95
|
/** Can request password reset via email */
|
|
91
96
|
changePasswordViaEmail: boolean;
|
|
92
97
|
|
|
98
|
+
/** Can verify a customer's email address (code or link) */
|
|
99
|
+
verifyEmail: boolean;
|
|
100
|
+
|
|
93
101
|
/** Can delete customer account (self-service) */
|
|
94
102
|
deleteAccount: boolean;
|
|
95
103
|
|
|
@@ -545,7 +553,7 @@ export interface CommerceProvider {
|
|
|
545
553
|
* @param options.regionId - Region ID for the cart (required for some providers like Medusa)
|
|
546
554
|
* @returns New cart instance
|
|
547
555
|
*/
|
|
548
|
-
createCart(options?: { regionId?: string }): Promise<Cart>;
|
|
556
|
+
createCart(options?: { regionId?: string; salesChannelId?: string }): Promise<Cart>;
|
|
549
557
|
|
|
550
558
|
/**
|
|
551
559
|
* Get an existing cart by ID
|
|
@@ -567,6 +575,23 @@ export interface CommerceProvider {
|
|
|
567
575
|
* @throws {ProviderAPIError} If the cart cannot be transferred
|
|
568
576
|
*/
|
|
569
577
|
assignCartToCustomer?(cartId: string): Promise<Cart>;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Persist the guest checkout contact (email + name + phone) on the cart.
|
|
581
|
+
*
|
|
582
|
+
* The backend writes `cart.email` and merges
|
|
583
|
+
* `cart.metadata.guest_contact`; it never writes the Customer record. The
|
|
584
|
+
* provider must carry no customer token: the cart id is the capability and
|
|
585
|
+
* the backend enforces the guest/channel rules.
|
|
586
|
+
*
|
|
587
|
+
* @param cartId - Cart ID
|
|
588
|
+
* @param contact - Guest contact values
|
|
589
|
+
* @returns The updated cart with the contact stored
|
|
590
|
+
*/
|
|
591
|
+
updateCheckoutGuestContact?(
|
|
592
|
+
cartId: string,
|
|
593
|
+
contact: CheckoutGuestContact,
|
|
594
|
+
): Promise<Cart>;
|
|
570
595
|
|
|
571
596
|
/**
|
|
572
597
|
* Add items to cart
|
|
@@ -744,6 +769,23 @@ export interface CommerceProvider {
|
|
|
744
769
|
cartId: string,
|
|
745
770
|
selections: ShippingGroupSelection[],
|
|
746
771
|
): Promise<void>;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Project stock and the effective quantity-price ladder for each cart line
|
|
775
|
+
* (OPTIONAL).
|
|
776
|
+
*
|
|
777
|
+
* The backend selects the effective price group with Medusa's pricing engine
|
|
778
|
+
* and reports the maximum number of complete units a single sales-channel
|
|
779
|
+
* warehouse can serve. Callers render the values; they never sum stock across
|
|
780
|
+
* warehouses, mix price groups or derive a price locally.
|
|
781
|
+
*
|
|
782
|
+
* Optional for the same reason as `getCheckoutShippingGroups`; its absence
|
|
783
|
+
* is an unsupported capability, not an empty projection.
|
|
784
|
+
*
|
|
785
|
+
* @param cartId - Cart ID
|
|
786
|
+
* @throws {ProviderAPIError} If the backend fails or returns an invalid projection
|
|
787
|
+
*/
|
|
788
|
+
getCheckoutLineProjection?(cartId: string): Promise<CheckoutLineProjection>;
|
|
747
789
|
|
|
748
790
|
/**
|
|
749
791
|
* Initiate payment session with provider
|
|
@@ -918,6 +960,18 @@ export interface CommerceProvider {
|
|
|
918
960
|
* @returns Order or undefined if not found
|
|
919
961
|
*/
|
|
920
962
|
getOrder?(orderId: string): Promise<Order | undefined>;
|
|
963
|
+
|
|
964
|
+
/**
|
|
965
|
+
* Read a single order through the channel-scoped guest receipt route
|
|
966
|
+
* (OPTIONAL).
|
|
967
|
+
*
|
|
968
|
+
* Unlike `getOrder`, the backend resolves the sales channel from the
|
|
969
|
+
* publishable key and returns 404 for an order from another channel. The
|
|
970
|
+
* runtime uses it for the unauthenticated confirmation page; a provider
|
|
971
|
+
* without it falls back to `getOrder` and must expose `Order.salesChannelId`
|
|
972
|
+
* so the runtime can verify the channel itself.
|
|
973
|
+
*/
|
|
974
|
+
getCheckoutOrder?(orderId: string): Promise<Order | undefined>;
|
|
921
975
|
|
|
922
976
|
/**
|
|
923
977
|
* Get all orders for a customer (optional)
|
|
@@ -944,23 +998,45 @@ export interface CommerceProvider {
|
|
|
944
998
|
customerOrdersPage?(options: GetCustomerOrdersPageOptions): Promise<CustomerOrdersPage>;
|
|
945
999
|
|
|
946
1000
|
/**
|
|
947
|
-
* Resolve ONE order for the authenticated customer (OPTIONAL,
|
|
1001
|
+
* Resolve ONE order for the authenticated customer (OPTIONAL, legacy/mock).
|
|
948
1002
|
*
|
|
949
1003
|
* Ownership is enforced by the provider: an order that belongs to another
|
|
950
1004
|
* customer, another channel, or no customer resolves as `undefined` — the
|
|
951
|
-
* caller must not learn whether it exists.
|
|
952
|
-
* this method (a backend without a customer detail endpoint) fails closed at
|
|
953
|
-
* the runtime boundary; the storefront never derives the detail from the
|
|
954
|
-
* order-list payload.
|
|
955
|
-
*
|
|
956
|
-
* `options.salesChannelId` is the store's explicitly configured channel. A
|
|
957
|
-
* provider that can scope by channel MUST reject a foreign order as
|
|
958
|
-
* `undefined`.
|
|
1005
|
+
* caller must not learn whether it exists.
|
|
959
1006
|
*/
|
|
960
1007
|
customerOrderDetail?(
|
|
961
1008
|
orderId: string,
|
|
962
1009
|
options?: { salesChannelId?: string },
|
|
963
1010
|
): Promise<Order | undefined>;
|
|
1011
|
+
|
|
1012
|
+
/**
|
|
1013
|
+
* Read one server-side Order History page (OPTIONAL, additive).
|
|
1014
|
+
*
|
|
1015
|
+
* The backend applies search, filters, date, amount, sort and pagination to
|
|
1016
|
+
* the authenticated customer + sales channel set and returns the real total,
|
|
1017
|
+
* `totalAll`, `pageCount` and optional quick-filter counts. Native payment and
|
|
1018
|
+
* fulfillment statuses are preserved; the host maps them to the block
|
|
1019
|
+
* contract.
|
|
1020
|
+
*/
|
|
1021
|
+
customerOrderHistory?(
|
|
1022
|
+
options: CustomerOrderHistoryOptions,
|
|
1023
|
+
): Promise<CustomerOrderHistoryPage>;
|
|
1024
|
+
|
|
1025
|
+
/**
|
|
1026
|
+
* Read one authenticated customer's order detail snapshot (OPTIONAL).
|
|
1027
|
+
*
|
|
1028
|
+
* The backend enforces customer ownership and sales-channel scope before
|
|
1029
|
+
* returning any data. A foreign, unknown or other-channel order must fail
|
|
1030
|
+
* closed; the provider never receives a partial payload for those cases.
|
|
1031
|
+
*
|
|
1032
|
+
* The snapshot carries a per-section `issues` map and a non-blocking
|
|
1033
|
+
* `warning` for a partial load. A provider without this method (for example
|
|
1034
|
+
* the mock data source) fails closed at the runtime boundary.
|
|
1035
|
+
*/
|
|
1036
|
+
customerOrderDetailSnapshot?(
|
|
1037
|
+
orderId: string,
|
|
1038
|
+
options?: { signal?: AbortSignal },
|
|
1039
|
+
): Promise<CustomerOrderDetailSnapshot>;
|
|
964
1040
|
|
|
965
1041
|
// ============================================
|
|
966
1042
|
// Payment Operations
|
package/src/common.ts
CHANGED
|
@@ -93,3 +93,36 @@ export interface Country {
|
|
|
93
93
|
/** ISO 3166-1 numeric code (optional, e.g., "840", "724") */
|
|
94
94
|
numCode?: string;
|
|
95
95
|
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* How a promotion was applied.
|
|
99
|
+
*
|
|
100
|
+
* - `coupon`: the shopper entered a code.
|
|
101
|
+
* - `automatic`: the backend applied it without a code.
|
|
102
|
+
* - `discount`: an adjustment whose promotion identity is not available.
|
|
103
|
+
*/
|
|
104
|
+
export type PromotionKind = 'coupon' | 'automatic' | 'discount';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Where a promotion was applied, as far as the backend adjustments reveal.
|
|
108
|
+
*
|
|
109
|
+
* `items` and `shipping` are derived from the adjustment location. `order` is
|
|
110
|
+
* used when no adjustment location is available yet (for example a code applied
|
|
111
|
+
* before a shipping method exists).
|
|
112
|
+
*/
|
|
113
|
+
export type PromotionScope = 'order' | 'items' | 'shipping';
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* One promotion row from the backend's discount adjustments.
|
|
117
|
+
*
|
|
118
|
+
* `amount` is the sum of the adjustments attributed to this promotion, never a
|
|
119
|
+
* locally computed percentage or configured value.
|
|
120
|
+
*/
|
|
121
|
+
export interface PromotionSummary {
|
|
122
|
+
id: string;
|
|
123
|
+
code?: string;
|
|
124
|
+
label: string;
|
|
125
|
+
kind: PromotionKind;
|
|
126
|
+
scope: PromotionScope;
|
|
127
|
+
amount: Money;
|
|
128
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,9 @@ export type {
|
|
|
18
18
|
PaginationOptions,
|
|
19
19
|
SortOptions,
|
|
20
20
|
Country,
|
|
21
|
+
PromotionKind,
|
|
22
|
+
PromotionScope,
|
|
23
|
+
PromotionSummary,
|
|
21
24
|
} from './common';
|
|
22
25
|
|
|
23
26
|
// ============================================
|
|
@@ -40,6 +43,8 @@ export type {
|
|
|
40
43
|
CheckoutLocationOptions,
|
|
41
44
|
CheckoutAddressValues,
|
|
42
45
|
CheckoutContactValues,
|
|
46
|
+
GuestContact,
|
|
47
|
+
CheckoutGuestContact,
|
|
43
48
|
CheckoutCustomerIdentity,
|
|
44
49
|
CheckoutSavedAddress,
|
|
45
50
|
CheckoutShippingOption,
|
|
@@ -140,6 +145,9 @@ export type {
|
|
|
140
145
|
CartLineUpdate,
|
|
141
146
|
ShippingMethod,
|
|
142
147
|
DiscountCode,
|
|
148
|
+
PriceTier,
|
|
149
|
+
CheckoutLineProjection,
|
|
150
|
+
CheckoutLineProjectionLine,
|
|
143
151
|
} from './cart';
|
|
144
152
|
|
|
145
153
|
// ============================================
|
|
@@ -205,6 +213,74 @@ export type {
|
|
|
205
213
|
GetOrdersCallback,
|
|
206
214
|
GetCustomerOrdersPageOptions,
|
|
207
215
|
CustomerOrdersPage,
|
|
216
|
+
CustomerOrderAction,
|
|
217
|
+
CustomerOrderPaymentStatus,
|
|
218
|
+
CustomerOrderFulfillmentStatus,
|
|
219
|
+
CustomerOrderFulfillmentItemStatus,
|
|
220
|
+
CustomerOrderHistoryQuick,
|
|
221
|
+
CustomerOrderHistorySort,
|
|
222
|
+
CustomerOrderHistoryDatePreset,
|
|
223
|
+
CustomerOrderHistoryCommercialStatus,
|
|
224
|
+
CustomerOrderHistoryCommercialFilter,
|
|
225
|
+
CustomerOrderHistoryPaymentFilter,
|
|
226
|
+
CustomerOrderHistoryRefundFilter,
|
|
227
|
+
CustomerOrderHistoryFulfilmentFilter,
|
|
228
|
+
CustomerOrderHistoryDeliveryMode,
|
|
229
|
+
CustomerOrderHistoryReturnStatus,
|
|
230
|
+
CustomerOrderHistoryFilters,
|
|
231
|
+
CustomerOrderHistoryQuery,
|
|
232
|
+
CustomerOrderHistoryOptions,
|
|
233
|
+
CustomerOrderHistoryShipment,
|
|
234
|
+
CustomerOrderHistoryRecord,
|
|
235
|
+
CustomerOrderHistoryPage,
|
|
236
|
+
CustomerOrderDetail,
|
|
237
|
+
CustomerOrderDetailAction,
|
|
238
|
+
CustomerOrderDetailAdjustment,
|
|
239
|
+
CustomerOrderDetailAdjustmentDirection,
|
|
240
|
+
CustomerOrderDetailAdjustmentScope,
|
|
241
|
+
CustomerOrderDetailAdjustmentSource,
|
|
242
|
+
CustomerOrderDetailAllocation,
|
|
243
|
+
CustomerOrderDetailApprovalStatus,
|
|
244
|
+
CustomerOrderDetailAttachment,
|
|
245
|
+
CustomerOrderDetailAttribute,
|
|
246
|
+
CustomerOrderDetailAttributeKind,
|
|
247
|
+
CustomerOrderDetailBusiness,
|
|
248
|
+
CustomerOrderDetailCase,
|
|
249
|
+
CustomerOrderDetailCaseLine,
|
|
250
|
+
CustomerOrderDetailCaseStatus,
|
|
251
|
+
CustomerOrderDetailCaseType,
|
|
252
|
+
CustomerOrderDetailDocument,
|
|
253
|
+
CustomerOrderDetailDocumentKind,
|
|
254
|
+
CustomerOrderDetailFulfillment,
|
|
255
|
+
CustomerOrderDetailFulfillmentItemStatus,
|
|
256
|
+
CustomerOrderDetailFulfillmentStatus,
|
|
257
|
+
CustomerOrderDetailGroup,
|
|
258
|
+
CustomerOrderDetailInvoiceStatus,
|
|
259
|
+
CustomerOrderDetailIssue,
|
|
260
|
+
CustomerOrderDetailLine,
|
|
261
|
+
CustomerOrderDetailLinePrice,
|
|
262
|
+
CustomerOrderDetailOrder,
|
|
263
|
+
CustomerOrderDetailPackage,
|
|
264
|
+
CustomerOrderDetailPaymentStatus,
|
|
265
|
+
CustomerOrderDetailPickup,
|
|
266
|
+
CustomerOrderDetailPickupStatus,
|
|
267
|
+
CustomerOrderDetailPriceKind,
|
|
268
|
+
CustomerOrderDetailProductKind,
|
|
269
|
+
CustomerOrderDetailPromotion,
|
|
270
|
+
CustomerOrderDetailPromotionApplication,
|
|
271
|
+
CustomerOrderDetailPromotionNominal,
|
|
272
|
+
CustomerOrderDetailPromotionScope,
|
|
273
|
+
CustomerOrderDetailRevision,
|
|
274
|
+
CustomerOrderDetailRevisionKind,
|
|
275
|
+
CustomerOrderDetailSection,
|
|
276
|
+
CustomerOrderDetailShippingMethod,
|
|
277
|
+
CustomerOrderDetailSnapshot,
|
|
278
|
+
CustomerOrderDetailTaxLine,
|
|
279
|
+
CustomerOrderDetailTotals,
|
|
280
|
+
CustomerOrderDetailTransaction,
|
|
281
|
+
CustomerOrderDetailTransactionKind,
|
|
282
|
+
CustomerOrderDetailTransactionMethod,
|
|
283
|
+
CustomerOrderDetailTransactionStatus,
|
|
208
284
|
} from './order';
|
|
209
285
|
|
|
210
286
|
// ============================================
|