@thorprovider/types 7.7.0 → 7.8.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 +6 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/index.d.mts +172 -1
- package/dist/index.d.ts +172 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/cart.ts +75 -1
- package/src/checkout.ts +17 -0
- package/src/commerce-provider.ts +49 -1
- package/src/common.ts +33 -0
- package/src/index.ts +8 -0
- package/src/order.ts +16 -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} 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/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 {
|
|
@@ -45,6 +46,7 @@ import type {
|
|
|
45
46
|
GiftCardValidationResult,
|
|
46
47
|
StoreCreditAccountSummary,
|
|
47
48
|
} from './payment';
|
|
49
|
+
import type { CheckoutGuestContact } from './checkout';
|
|
48
50
|
import type { AuthProvider } from './auth';
|
|
49
51
|
import type { StorefrontContext } from './storefront';
|
|
50
52
|
import type { StockLocation, InventoryLevel, StockValidation, FulfillmentOption } from './stock-location';
|
|
@@ -545,7 +547,7 @@ export interface CommerceProvider {
|
|
|
545
547
|
* @param options.regionId - Region ID for the cart (required for some providers like Medusa)
|
|
546
548
|
* @returns New cart instance
|
|
547
549
|
*/
|
|
548
|
-
createCart(options?: { regionId?: string }): Promise<Cart>;
|
|
550
|
+
createCart(options?: { regionId?: string; salesChannelId?: string }): Promise<Cart>;
|
|
549
551
|
|
|
550
552
|
/**
|
|
551
553
|
* Get an existing cart by ID
|
|
@@ -567,6 +569,23 @@ export interface CommerceProvider {
|
|
|
567
569
|
* @throws {ProviderAPIError} If the cart cannot be transferred
|
|
568
570
|
*/
|
|
569
571
|
assignCartToCustomer?(cartId: string): Promise<Cart>;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Persist the guest checkout contact (email + name + phone) on the cart.
|
|
575
|
+
*
|
|
576
|
+
* The backend writes `cart.email` and merges
|
|
577
|
+
* `cart.metadata.guest_contact`; it never writes the Customer record. The
|
|
578
|
+
* provider must carry no customer token: the cart id is the capability and
|
|
579
|
+
* the backend enforces the guest/channel rules.
|
|
580
|
+
*
|
|
581
|
+
* @param cartId - Cart ID
|
|
582
|
+
* @param contact - Guest contact values
|
|
583
|
+
* @returns The updated cart with the contact stored
|
|
584
|
+
*/
|
|
585
|
+
updateCheckoutGuestContact?(
|
|
586
|
+
cartId: string,
|
|
587
|
+
contact: CheckoutGuestContact,
|
|
588
|
+
): Promise<Cart>;
|
|
570
589
|
|
|
571
590
|
/**
|
|
572
591
|
* Add items to cart
|
|
@@ -744,6 +763,23 @@ export interface CommerceProvider {
|
|
|
744
763
|
cartId: string,
|
|
745
764
|
selections: ShippingGroupSelection[],
|
|
746
765
|
): Promise<void>;
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Project stock and the effective quantity-price ladder for each cart line
|
|
769
|
+
* (OPTIONAL).
|
|
770
|
+
*
|
|
771
|
+
* The backend selects the effective price group with Medusa's pricing engine
|
|
772
|
+
* and reports the maximum number of complete units a single sales-channel
|
|
773
|
+
* warehouse can serve. Callers render the values; they never sum stock across
|
|
774
|
+
* warehouses, mix price groups or derive a price locally.
|
|
775
|
+
*
|
|
776
|
+
* Optional for the same reason as `getCheckoutShippingGroups`; its absence
|
|
777
|
+
* is an unsupported capability, not an empty projection.
|
|
778
|
+
*
|
|
779
|
+
* @param cartId - Cart ID
|
|
780
|
+
* @throws {ProviderAPIError} If the backend fails or returns an invalid projection
|
|
781
|
+
*/
|
|
782
|
+
getCheckoutLineProjection?(cartId: string): Promise<CheckoutLineProjection>;
|
|
747
783
|
|
|
748
784
|
/**
|
|
749
785
|
* Initiate payment session with provider
|
|
@@ -918,6 +954,18 @@ export interface CommerceProvider {
|
|
|
918
954
|
* @returns Order or undefined if not found
|
|
919
955
|
*/
|
|
920
956
|
getOrder?(orderId: string): Promise<Order | undefined>;
|
|
957
|
+
|
|
958
|
+
/**
|
|
959
|
+
* Read a single order through the channel-scoped guest receipt route
|
|
960
|
+
* (OPTIONAL).
|
|
961
|
+
*
|
|
962
|
+
* Unlike `getOrder`, the backend resolves the sales channel from the
|
|
963
|
+
* publishable key and returns 404 for an order from another channel. The
|
|
964
|
+
* runtime uses it for the unauthenticated confirmation page; a provider
|
|
965
|
+
* without it falls back to `getOrder` and must expose `Order.salesChannelId`
|
|
966
|
+
* so the runtime can verify the channel itself.
|
|
967
|
+
*/
|
|
968
|
+
getCheckoutOrder?(orderId: string): Promise<Order | undefined>;
|
|
921
969
|
|
|
922
970
|
/**
|
|
923
971
|
* Get all orders for a customer (optional)
|
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
|
// ============================================
|
package/src/order.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Universal interfaces compatible with: Shopify, Medusa.js, WooCommerce, Magento, BigCommerce
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import type { Money, Image } from './common';
|
|
7
|
+
import type { Money, Image, PromotionSummary } from './common';
|
|
8
8
|
import type { Address, Customer } from './customer';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -97,6 +97,8 @@ export interface OrderDeliveryGroup {
|
|
|
97
97
|
/**
|
|
98
98
|
* Order-line ids belonging to this group, only when the backend exposes the
|
|
99
99
|
* membership. Consumers MUST NOT invent an assignment when it is absent.
|
|
100
|
+
* A line whose allocations span more than one group is ambiguous and is
|
|
101
|
+
* omitted from every group rather than assigned arbitrarily.
|
|
100
102
|
*/
|
|
101
103
|
lineIds?: string[];
|
|
102
104
|
}
|
|
@@ -138,6 +140,14 @@ export interface Order {
|
|
|
138
140
|
// Customer
|
|
139
141
|
customerId?: string;
|
|
140
142
|
customer?: Customer;
|
|
143
|
+
/**
|
|
144
|
+
* Sales channel the order belongs to (Medusa `sales_channel_id`).
|
|
145
|
+
*
|
|
146
|
+
* Carried so the runtime can prove a receipt belongs to the validated store
|
|
147
|
+
* channel before rendering it; a provider that cannot expose it leaves it
|
|
148
|
+
* absent and the receipt path fails closed.
|
|
149
|
+
*/
|
|
150
|
+
salesChannelId?: string;
|
|
141
151
|
|
|
142
152
|
// Items
|
|
143
153
|
items: OrderItem[];
|
|
@@ -177,6 +187,11 @@ export interface Order {
|
|
|
177
187
|
* can render its breakdown after a reload without inventing amounts.
|
|
178
188
|
*/
|
|
179
189
|
payments?: OrderPayment[];
|
|
190
|
+
/**
|
|
191
|
+
* One row per promotion resolved from the order's item and shipping
|
|
192
|
+
* adjustments. Absent when the backend does not expose a breakdown.
|
|
193
|
+
*/
|
|
194
|
+
promotions?: PromotionSummary[];
|
|
180
195
|
/** Backend tax rate in basis points, when the order reports one rate. */
|
|
181
196
|
taxRateBps?: number;
|
|
182
197
|
|