@mitumba/sdk 5.30.0 → 5.31.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/dist/index.d.mts CHANGED
@@ -2928,9 +2928,13 @@ interface StoreSettings {
2928
2928
  bus_partners: string[];
2929
2929
  delivery_days_min: number;
2930
2930
  delivery_days_max: number;
2931
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2931
2932
  payout_method: 'mpesa' | 'bank';
2933
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2932
2934
  payout_mpesa_number: string | null;
2935
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2933
2936
  payout_bank_name: string | null;
2937
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2934
2938
  payout_account_number: string | null;
2935
2939
  payout_frequency: 'instant' | 'daily' | 'weekly';
2936
2940
  accept_returns: boolean;
@@ -2986,6 +2990,140 @@ interface StoreAnalytics {
2986
2990
  };
2987
2991
  }
2988
2992
 
2993
+ /**
2994
+ * Where an order's payout stands:
2995
+ * - `in_escrow`: paid, being fulfilled, or delivered with the buyer's window still open.
2996
+ * - `on_hold`: disputed, or held.
2997
+ * - `awaiting_approval`: completed; waits to be released.
2998
+ * - `approved`: released, not yet sent.
2999
+ * - `sending`: submitted, not yet confirmed.
3000
+ * - `sent`: confirmed.
3001
+ * - `failed`: refused by the provider.
3002
+ * - `test`: paid in a test environment; never paid out.
3003
+ */
3004
+ type PayoutState = 'in_escrow' | 'on_hold' | 'awaiting_approval' | 'approved' | 'sending' | 'sent' | 'failed' | 'test';
3005
+ /** Totals for one currency, per payout state, in minor units. */
3006
+ interface EarningsBalance {
3007
+ currency: string;
3008
+ totals: Record<PayoutState, {
3009
+ amount_minor: number;
3010
+ count: number;
3011
+ }>;
3012
+ /** Whether any amount is an estimate (an order with no payout yet). */
3013
+ includes_estimates: boolean;
3014
+ }
3015
+ /** `GET /orders/stores/:storeId/earnings`. */
3016
+ interface ShopEarnings {
3017
+ store_id: string;
3018
+ /** One per currency, sorted by currency code. */
3019
+ balances: EarningsBalance[];
3020
+ /** When the owner's payouts are frozen until, or null. */
3021
+ frozen_until: string | null;
3022
+ }
3023
+ /** A payout destination as everyone sees it: masked. */
3024
+ interface PayoutDestinationLabel {
3025
+ method: PayoutMethodType;
3026
+ label: string;
3027
+ }
3028
+ /** One order's entitlement: what the shop is owed or was paid for it. */
3029
+ interface ShopPayoutEntry {
3030
+ /** The payout's id, or null while the order has no payout yet. */
3031
+ id: string | null;
3032
+ order_id: string;
3033
+ invoice_number: string | null;
3034
+ state: PayoutState;
3035
+ amount_minor: number;
3036
+ currency: string;
3037
+ /** True when `amount_minor` is an estimate from the order's frozen fees. */
3038
+ estimated: boolean;
3039
+ created_at: string;
3040
+ /** When the provider confirmed it, for a sent payout. */
3041
+ sent_at: string | null;
3042
+ /** Where it was sent, for a payout that is sending, sent or failed. */
3043
+ destination: PayoutDestinationLabel | null;
3044
+ }
3045
+ /** `GET /orders/stores/:storeId/earnings/entries`. */
3046
+ interface ShopPayoutEntriesPage {
3047
+ data: ShopPayoutEntry[];
3048
+ page: number;
3049
+ page_size: number;
3050
+ total: number;
3051
+ }
3052
+ interface ShopPayoutEntriesParams {
3053
+ state?: PayoutState;
3054
+ page?: number;
3055
+ }
3056
+ /** `GET /orders/stores/:storeId/payouts/:payoutId`: one payout with its settlement lines. */
3057
+ interface ShopPayout extends ShopPayoutEntry {
3058
+ id: string;
3059
+ /** Signed lines in minor units that sum to the payout. */
3060
+ lines: SettlementLine[];
3061
+ }
3062
+ /** A payout method. A market lists the ones it offers. */
3063
+ type PayoutMethodType = 'mpesa_mobile' | 'mpesa_pochi' | 'mpesa_till' | 'mpesa_paybill' | 'bank_account';
3064
+ interface PayoutMethodOption {
3065
+ id: PayoutMethodType;
3066
+ name: string;
3067
+ /** Whether destinations of this method can be added now. */
3068
+ enabled: boolean;
3069
+ }
3070
+ interface PayoutBankOption {
3071
+ id: string;
3072
+ name: string;
3073
+ }
3074
+ /** One of the shop's destinations, masked. */
3075
+ interface PayoutDestination {
3076
+ id: string;
3077
+ method: PayoutMethodType;
3078
+ method_name: string;
3079
+ label: string;
3080
+ /** `cooling_off` until `effective_at`: it cannot receive payouts yet. */
3081
+ state: 'active' | 'cooling_off';
3082
+ effective_at: string;
3083
+ is_default: boolean;
3084
+ created_at: string;
3085
+ }
3086
+ /** The shop's destinations, as every change answers. */
3087
+ interface PayoutDestinationsState {
3088
+ destinations: PayoutDestination[];
3089
+ default_destination_id: string | null;
3090
+ /** A change of default waiting out its cooling-off, or null. */
3091
+ pending_default: {
3092
+ destination_id: string;
3093
+ from: string;
3094
+ } | null;
3095
+ }
3096
+ /** `GET /listings/stores/:storeId/payout-destinations`. */
3097
+ interface PayoutDestinations extends PayoutDestinationsState {
3098
+ market_code: string;
3099
+ methods: PayoutMethodOption[];
3100
+ banks: PayoutBankOption[];
3101
+ /** Whether the caller may change them (the owner). */
3102
+ can_manage: boolean;
3103
+ }
3104
+ /** What the owner gives for each method. */
3105
+ type AddPayoutDestinationInput = {
3106
+ method: 'mpesa_mobile' | 'mpesa_pochi';
3107
+ phone: string;
3108
+ make_default?: boolean;
3109
+ } | {
3110
+ method: 'mpesa_till';
3111
+ till_number: string;
3112
+ make_default?: boolean;
3113
+ } | {
3114
+ method: 'mpesa_paybill';
3115
+ paybill_number: string;
3116
+ account_number: string;
3117
+ make_default?: boolean;
3118
+ } | {
3119
+ method: 'bank_account';
3120
+ bank_id: string;
3121
+ account_number: string;
3122
+ make_default?: boolean;
3123
+ };
3124
+ /** Why a destination was refused on entry, with the field to fix. */
3125
+ type PayoutDestinationRejection = 'invalid_phone' | 'invalid_till' | 'invalid_paybill' | 'invalid_account' | 'unknown_bank' | 'method_not_offered';
3126
+
2989
3127
  interface Review {
2990
3128
  id: string;
2991
3129
  store_id: string;
@@ -4515,7 +4653,64 @@ declare class StoresModule {
4515
4653
  blocked: true;
4516
4654
  reasons: string[];
4517
4655
  }>;
4656
+ /**
4657
+ * A shop's earnings: per currency, what is in escrow, on hold, awaiting approval, approved,
4658
+ * sending, sent, failed or a test, in minor units. The owner, or a team member who may read
4659
+ * earnings.
4660
+ *
4661
+ * Errors: 403 forbidden (a member whose role does not include earnings); 404 not_found.
4662
+ */
4663
+ getEarnings(storeId: string, options?: RequestOptions): Promise<ShopEarnings>;
4664
+ /**
4665
+ * Each paid order's entitlement, newest first, 20 per page, optionally of one state.
4666
+ *
4667
+ * Errors: 400 invalid_input (unknown state); 403 forbidden; 404 not_found.
4668
+ */
4669
+ getEarningsEntries(storeId: string, params?: ShopPayoutEntriesParams, options?: RequestOptions): Promise<ShopPayoutEntriesPage>;
4670
+ /**
4671
+ * One payout of the shop, with the settlement lines that explain it.
4672
+ *
4673
+ * Errors: 403 forbidden; 404 not_found.
4674
+ */
4675
+ getPayout(storeId: string, payoutId: string, options?: RequestOptions): Promise<ShopPayout>;
4676
+ /**
4677
+ * Where the shop is paid: its destinations, masked, with the methods and banks on offer. The
4678
+ * owner, or a team member who may read earnings.
4679
+ *
4680
+ * Errors: 403 store_forbidden.
4681
+ */
4682
+ getPayoutDestinations(storeId: string, options?: RequestOptions): Promise<PayoutDestinations>;
4683
+ /**
4684
+ * Owner: add a payout destination. The shop's first applies at once; every later one, and a change
4685
+ * of default, 48 hours later. Needs a second factor used in the last 10 minutes.
4686
+ *
4687
+ * Errors: 400 invalid_input, or a `PayoutDestinationRejection` with `field`; 403 store_forbidden,
4688
+ * step_up_required; 409 method_unavailable, destination_exists, too_many_destinations.
4689
+ */
4690
+ addPayoutDestination(storeId: string, input: AddPayoutDestinationInput, options?: RequestOptions): Promise<PayoutDestinationsState>;
4691
+ /**
4692
+ * Owner: make a destination the default, 48 hours from now. Choosing the current default again
4693
+ * cancels any pending change. Needs a recent second factor.
4694
+ *
4695
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
4696
+ */
4697
+ setDefaultPayoutDestination(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4698
+ /**
4699
+ * Owner: cancel a pending change of default to this destination. Needs a recent second factor.
4700
+ *
4701
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found; 409 no_pending_default.
4702
+ */
4703
+ cancelPendingDefault(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4704
+ /**
4705
+ * Owner: remove a destination, or cancel one still cooling off. Needs a recent second factor.
4706
+ *
4707
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
4708
+ */
4709
+ removePayoutDestination(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4710
+ private destinationPath;
4518
4711
  }
4712
+ /** Whether an error asks the caller to sign in again with a second factor before retrying. */
4713
+ declare function stepUpRequired(error: unknown): boolean;
4519
4714
 
4520
4715
  declare class ReviewsModule {
4521
4716
  private readonly client;
@@ -5653,4 +5848,4 @@ declare class MitumbaClient {
5653
5848
  isAuthenticated(): Promise<boolean>;
5654
5849
  }
5655
5850
 
5656
- export { APIClient, APIError, type APIErrorResponse, type ActivateIamUserInput, type ActivateIamUserResult, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddIamPasskeyResult, type AddIamTotpResult, type AddIamTwoFactorMethodInput, type AddPaymentMethodInput, type Address, type AdminAuditActor, type AdminAuditEntry, type AdminAuditQuery, type AdminAuthStrength, type AdminListingItem, type AdminMessageReport, type AdminMessageReportDetail, type AdminMessageReportList, type AdminMessageReportThreadMessage, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CancelCheckoutRefusalCode, type CancelCheckoutResponse, type CancelOrderInput, type CancelOrderResult, type CartItem, type CartLineAvailability, CartModule, type CartPartition, type CategoriesBySection, type Category, type CategorySection, type ChangePasswordInput, type ChangePlatformSettingInput, type ChangePlatformSettingResult, type Checkout, type CheckoutMoney, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutRefusal, type CheckoutRefusalCode, type CheckoutShopOrder, type CheckoutState, type CheckoutStatus, type CheckoutStatusResponse, CheckoutsModule, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateCheckoutInput, type CreateCheckoutResponse, type CreateIamUserInput, type CreateIamUserResult, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateOrganizationInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CreatedBaleOrder, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FileResponse, type FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, type GetCheckoutResponse, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, type IamSession, type IamSessionsResult, type IamSignIn, type IamSignInFailureReason, type IamSignInsResult, type IamTokens, type IamTwoFactorRequired, type IamUser, type IamUserStatus, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, type KnownShopStep, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LibraryCadence, type LibraryCompleter, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, type LibraryOccurrence, type LibraryOccurrenceRecorded, type LibraryOccurrenceStatus, type LibraryRoutineState, type LibrarySchedule, type LibraryScheduleRule, type LibrarySeason, type LibraryWeekday, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LiveUnread, type LiveUnreadOptions, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketRegion, type MarketRegionsResponse, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportOutcome, type MessageReportReason, type MessageReportStatus, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, type MessagingSide, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationAction, type NotificationCategory, type NotificationFlash, type NotificationLink, type NotificationPref, type NotificationStream, type NotificationStreamFrame, type NotificationStreamItem, type NotificationStreamOptions, type NotificationStreamState, type NotificationStreamTicket, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthClient, type OAuthClientSummary, type OAuthClientTrustLevel, type OAuthClientType, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OidcSigningKey, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderDocument, type OrderDocumentKind, type OrderEvent, type OrderHistoryEntry, type OrderHistoryParams, type OrderItem, type OrderItemSummary, type OrderStatus, OrdersModule, type Organization, type OrganizationKind, type OrganizationStatus, type OrganizationSummary, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PlatformSetting, type PlatformSettingChange, type PlatformSettingDetail, type PlatformSettingGroup, type PlatformSettingKind, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegisterOAuthClientInput, type RegisteredOAuthClient, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveMessageReportInput, type ResolveMessageReportResult, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendTestNotificationResult, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type SettlementLine, type ShareUrlOptions, type ShopCancelReason, type ShopHolder, type ShopNextStep, type ShopOrderFields, type ShopSettlement, type ShopStep, type SilentAuthorizeResult, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateOrganizationInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyIamMethodResult, type VerifyIamTwoFactorInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleReviewStatus, type WholesaleStore, type WishlistListing, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, storeShareUrl };
5851
+ export { APIClient, APIError, type APIErrorResponse, type ActivateIamUserInput, type ActivateIamUserResult, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddIamPasskeyResult, type AddIamTotpResult, type AddIamTwoFactorMethodInput, type AddPaymentMethodInput, type AddPayoutDestinationInput, type Address, type AdminAuditActor, type AdminAuditEntry, type AdminAuditQuery, type AdminAuthStrength, type AdminListingItem, type AdminMessageReport, type AdminMessageReportDetail, type AdminMessageReportList, type AdminMessageReportThreadMessage, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CancelCheckoutRefusalCode, type CancelCheckoutResponse, type CancelOrderInput, type CancelOrderResult, type CartItem, type CartLineAvailability, CartModule, type CartPartition, type CategoriesBySection, type Category, type CategorySection, type ChangePasswordInput, type ChangePlatformSettingInput, type ChangePlatformSettingResult, type Checkout, type CheckoutMoney, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutRefusal, type CheckoutRefusalCode, type CheckoutShopOrder, type CheckoutState, type CheckoutStatus, type CheckoutStatusResponse, CheckoutsModule, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateCheckoutInput, type CreateCheckoutResponse, type CreateIamUserInput, type CreateIamUserResult, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateOrganizationInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CreatedBaleOrder, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EarningsBalance, type EmailLoginInput, type EmailRegisterInput, type FileResponse, type FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, type GetCheckoutResponse, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, type IamSession, type IamSessionsResult, type IamSignIn, type IamSignInFailureReason, type IamSignInsResult, type IamTokens, type IamTwoFactorRequired, type IamUser, type IamUserStatus, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, type KnownShopStep, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LibraryCadence, type LibraryCompleter, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, type LibraryOccurrence, type LibraryOccurrenceRecorded, type LibraryOccurrenceStatus, type LibraryRoutineState, type LibrarySchedule, type LibraryScheduleRule, type LibrarySeason, type LibraryWeekday, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LiveUnread, type LiveUnreadOptions, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketRegion, type MarketRegionsResponse, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportOutcome, type MessageReportReason, type MessageReportStatus, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, type MessagingSide, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationAction, type NotificationCategory, type NotificationFlash, type NotificationLink, type NotificationPref, type NotificationStream, type NotificationStreamFrame, type NotificationStreamItem, type NotificationStreamOptions, type NotificationStreamState, type NotificationStreamTicket, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthClient, type OAuthClientSummary, type OAuthClientTrustLevel, type OAuthClientType, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OidcSigningKey, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderDocument, type OrderDocumentKind, type OrderEvent, type OrderHistoryEntry, type OrderHistoryParams, type OrderItem, type OrderItemSummary, type OrderStatus, OrdersModule, type Organization, type OrganizationKind, type OrganizationStatus, type OrganizationSummary, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PayoutBankOption, type PayoutDestination, type PayoutDestinationLabel, type PayoutDestinationRejection, type PayoutDestinations, type PayoutDestinationsState, type PayoutMethodOption, type PayoutMethodType, type PayoutState, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PlatformSetting, type PlatformSettingChange, type PlatformSettingDetail, type PlatformSettingGroup, type PlatformSettingKind, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegisterOAuthClientInput, type RegisteredOAuthClient, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveMessageReportInput, type ResolveMessageReportResult, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendTestNotificationResult, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type SettlementLine, type ShareUrlOptions, type ShopCancelReason, type ShopEarnings, type ShopHolder, type ShopNextStep, type ShopOrderFields, type ShopPayout, type ShopPayoutEntriesPage, type ShopPayoutEntriesParams, type ShopPayoutEntry, type ShopSettlement, type ShopStep, type SilentAuthorizeResult, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateOrganizationInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyIamMethodResult, type VerifyIamTwoFactorInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleReviewStatus, type WholesaleStore, type WishlistListing, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, stepUpRequired, storeShareUrl };
package/dist/index.d.ts CHANGED
@@ -2928,9 +2928,13 @@ interface StoreSettings {
2928
2928
  bus_partners: string[];
2929
2929
  delivery_days_min: number;
2930
2930
  delivery_days_max: number;
2931
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2931
2932
  payout_method: 'mpesa' | 'bank';
2933
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2932
2934
  payout_mpesa_number: string | null;
2935
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2933
2936
  payout_bank_name: string | null;
2937
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2934
2938
  payout_account_number: string | null;
2935
2939
  payout_frequency: 'instant' | 'daily' | 'weekly';
2936
2940
  accept_returns: boolean;
@@ -2986,6 +2990,140 @@ interface StoreAnalytics {
2986
2990
  };
2987
2991
  }
2988
2992
 
2993
+ /**
2994
+ * Where an order's payout stands:
2995
+ * - `in_escrow`: paid, being fulfilled, or delivered with the buyer's window still open.
2996
+ * - `on_hold`: disputed, or held.
2997
+ * - `awaiting_approval`: completed; waits to be released.
2998
+ * - `approved`: released, not yet sent.
2999
+ * - `sending`: submitted, not yet confirmed.
3000
+ * - `sent`: confirmed.
3001
+ * - `failed`: refused by the provider.
3002
+ * - `test`: paid in a test environment; never paid out.
3003
+ */
3004
+ type PayoutState = 'in_escrow' | 'on_hold' | 'awaiting_approval' | 'approved' | 'sending' | 'sent' | 'failed' | 'test';
3005
+ /** Totals for one currency, per payout state, in minor units. */
3006
+ interface EarningsBalance {
3007
+ currency: string;
3008
+ totals: Record<PayoutState, {
3009
+ amount_minor: number;
3010
+ count: number;
3011
+ }>;
3012
+ /** Whether any amount is an estimate (an order with no payout yet). */
3013
+ includes_estimates: boolean;
3014
+ }
3015
+ /** `GET /orders/stores/:storeId/earnings`. */
3016
+ interface ShopEarnings {
3017
+ store_id: string;
3018
+ /** One per currency, sorted by currency code. */
3019
+ balances: EarningsBalance[];
3020
+ /** When the owner's payouts are frozen until, or null. */
3021
+ frozen_until: string | null;
3022
+ }
3023
+ /** A payout destination as everyone sees it: masked. */
3024
+ interface PayoutDestinationLabel {
3025
+ method: PayoutMethodType;
3026
+ label: string;
3027
+ }
3028
+ /** One order's entitlement: what the shop is owed or was paid for it. */
3029
+ interface ShopPayoutEntry {
3030
+ /** The payout's id, or null while the order has no payout yet. */
3031
+ id: string | null;
3032
+ order_id: string;
3033
+ invoice_number: string | null;
3034
+ state: PayoutState;
3035
+ amount_minor: number;
3036
+ currency: string;
3037
+ /** True when `amount_minor` is an estimate from the order's frozen fees. */
3038
+ estimated: boolean;
3039
+ created_at: string;
3040
+ /** When the provider confirmed it, for a sent payout. */
3041
+ sent_at: string | null;
3042
+ /** Where it was sent, for a payout that is sending, sent or failed. */
3043
+ destination: PayoutDestinationLabel | null;
3044
+ }
3045
+ /** `GET /orders/stores/:storeId/earnings/entries`. */
3046
+ interface ShopPayoutEntriesPage {
3047
+ data: ShopPayoutEntry[];
3048
+ page: number;
3049
+ page_size: number;
3050
+ total: number;
3051
+ }
3052
+ interface ShopPayoutEntriesParams {
3053
+ state?: PayoutState;
3054
+ page?: number;
3055
+ }
3056
+ /** `GET /orders/stores/:storeId/payouts/:payoutId`: one payout with its settlement lines. */
3057
+ interface ShopPayout extends ShopPayoutEntry {
3058
+ id: string;
3059
+ /** Signed lines in minor units that sum to the payout. */
3060
+ lines: SettlementLine[];
3061
+ }
3062
+ /** A payout method. A market lists the ones it offers. */
3063
+ type PayoutMethodType = 'mpesa_mobile' | 'mpesa_pochi' | 'mpesa_till' | 'mpesa_paybill' | 'bank_account';
3064
+ interface PayoutMethodOption {
3065
+ id: PayoutMethodType;
3066
+ name: string;
3067
+ /** Whether destinations of this method can be added now. */
3068
+ enabled: boolean;
3069
+ }
3070
+ interface PayoutBankOption {
3071
+ id: string;
3072
+ name: string;
3073
+ }
3074
+ /** One of the shop's destinations, masked. */
3075
+ interface PayoutDestination {
3076
+ id: string;
3077
+ method: PayoutMethodType;
3078
+ method_name: string;
3079
+ label: string;
3080
+ /** `cooling_off` until `effective_at`: it cannot receive payouts yet. */
3081
+ state: 'active' | 'cooling_off';
3082
+ effective_at: string;
3083
+ is_default: boolean;
3084
+ created_at: string;
3085
+ }
3086
+ /** The shop's destinations, as every change answers. */
3087
+ interface PayoutDestinationsState {
3088
+ destinations: PayoutDestination[];
3089
+ default_destination_id: string | null;
3090
+ /** A change of default waiting out its cooling-off, or null. */
3091
+ pending_default: {
3092
+ destination_id: string;
3093
+ from: string;
3094
+ } | null;
3095
+ }
3096
+ /** `GET /listings/stores/:storeId/payout-destinations`. */
3097
+ interface PayoutDestinations extends PayoutDestinationsState {
3098
+ market_code: string;
3099
+ methods: PayoutMethodOption[];
3100
+ banks: PayoutBankOption[];
3101
+ /** Whether the caller may change them (the owner). */
3102
+ can_manage: boolean;
3103
+ }
3104
+ /** What the owner gives for each method. */
3105
+ type AddPayoutDestinationInput = {
3106
+ method: 'mpesa_mobile' | 'mpesa_pochi';
3107
+ phone: string;
3108
+ make_default?: boolean;
3109
+ } | {
3110
+ method: 'mpesa_till';
3111
+ till_number: string;
3112
+ make_default?: boolean;
3113
+ } | {
3114
+ method: 'mpesa_paybill';
3115
+ paybill_number: string;
3116
+ account_number: string;
3117
+ make_default?: boolean;
3118
+ } | {
3119
+ method: 'bank_account';
3120
+ bank_id: string;
3121
+ account_number: string;
3122
+ make_default?: boolean;
3123
+ };
3124
+ /** Why a destination was refused on entry, with the field to fix. */
3125
+ type PayoutDestinationRejection = 'invalid_phone' | 'invalid_till' | 'invalid_paybill' | 'invalid_account' | 'unknown_bank' | 'method_not_offered';
3126
+
2989
3127
  interface Review {
2990
3128
  id: string;
2991
3129
  store_id: string;
@@ -4515,7 +4653,64 @@ declare class StoresModule {
4515
4653
  blocked: true;
4516
4654
  reasons: string[];
4517
4655
  }>;
4656
+ /**
4657
+ * A shop's earnings: per currency, what is in escrow, on hold, awaiting approval, approved,
4658
+ * sending, sent, failed or a test, in minor units. The owner, or a team member who may read
4659
+ * earnings.
4660
+ *
4661
+ * Errors: 403 forbidden (a member whose role does not include earnings); 404 not_found.
4662
+ */
4663
+ getEarnings(storeId: string, options?: RequestOptions): Promise<ShopEarnings>;
4664
+ /**
4665
+ * Each paid order's entitlement, newest first, 20 per page, optionally of one state.
4666
+ *
4667
+ * Errors: 400 invalid_input (unknown state); 403 forbidden; 404 not_found.
4668
+ */
4669
+ getEarningsEntries(storeId: string, params?: ShopPayoutEntriesParams, options?: RequestOptions): Promise<ShopPayoutEntriesPage>;
4670
+ /**
4671
+ * One payout of the shop, with the settlement lines that explain it.
4672
+ *
4673
+ * Errors: 403 forbidden; 404 not_found.
4674
+ */
4675
+ getPayout(storeId: string, payoutId: string, options?: RequestOptions): Promise<ShopPayout>;
4676
+ /**
4677
+ * Where the shop is paid: its destinations, masked, with the methods and banks on offer. The
4678
+ * owner, or a team member who may read earnings.
4679
+ *
4680
+ * Errors: 403 store_forbidden.
4681
+ */
4682
+ getPayoutDestinations(storeId: string, options?: RequestOptions): Promise<PayoutDestinations>;
4683
+ /**
4684
+ * Owner: add a payout destination. The shop's first applies at once; every later one, and a change
4685
+ * of default, 48 hours later. Needs a second factor used in the last 10 minutes.
4686
+ *
4687
+ * Errors: 400 invalid_input, or a `PayoutDestinationRejection` with `field`; 403 store_forbidden,
4688
+ * step_up_required; 409 method_unavailable, destination_exists, too_many_destinations.
4689
+ */
4690
+ addPayoutDestination(storeId: string, input: AddPayoutDestinationInput, options?: RequestOptions): Promise<PayoutDestinationsState>;
4691
+ /**
4692
+ * Owner: make a destination the default, 48 hours from now. Choosing the current default again
4693
+ * cancels any pending change. Needs a recent second factor.
4694
+ *
4695
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
4696
+ */
4697
+ setDefaultPayoutDestination(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4698
+ /**
4699
+ * Owner: cancel a pending change of default to this destination. Needs a recent second factor.
4700
+ *
4701
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found; 409 no_pending_default.
4702
+ */
4703
+ cancelPendingDefault(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4704
+ /**
4705
+ * Owner: remove a destination, or cancel one still cooling off. Needs a recent second factor.
4706
+ *
4707
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
4708
+ */
4709
+ removePayoutDestination(storeId: string, destinationId: string, options?: RequestOptions): Promise<PayoutDestinationsState>;
4710
+ private destinationPath;
4518
4711
  }
4712
+ /** Whether an error asks the caller to sign in again with a second factor before retrying. */
4713
+ declare function stepUpRequired(error: unknown): boolean;
4519
4714
 
4520
4715
  declare class ReviewsModule {
4521
4716
  private readonly client;
@@ -5653,4 +5848,4 @@ declare class MitumbaClient {
5653
5848
  isAuthenticated(): Promise<boolean>;
5654
5849
  }
5655
5850
 
5656
- export { APIClient, APIError, type APIErrorResponse, type ActivateIamUserInput, type ActivateIamUserResult, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddIamPasskeyResult, type AddIamTotpResult, type AddIamTwoFactorMethodInput, type AddPaymentMethodInput, type Address, type AdminAuditActor, type AdminAuditEntry, type AdminAuditQuery, type AdminAuthStrength, type AdminListingItem, type AdminMessageReport, type AdminMessageReportDetail, type AdminMessageReportList, type AdminMessageReportThreadMessage, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CancelCheckoutRefusalCode, type CancelCheckoutResponse, type CancelOrderInput, type CancelOrderResult, type CartItem, type CartLineAvailability, CartModule, type CartPartition, type CategoriesBySection, type Category, type CategorySection, type ChangePasswordInput, type ChangePlatformSettingInput, type ChangePlatformSettingResult, type Checkout, type CheckoutMoney, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutRefusal, type CheckoutRefusalCode, type CheckoutShopOrder, type CheckoutState, type CheckoutStatus, type CheckoutStatusResponse, CheckoutsModule, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateCheckoutInput, type CreateCheckoutResponse, type CreateIamUserInput, type CreateIamUserResult, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateOrganizationInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CreatedBaleOrder, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FileResponse, type FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, type GetCheckoutResponse, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, type IamSession, type IamSessionsResult, type IamSignIn, type IamSignInFailureReason, type IamSignInsResult, type IamTokens, type IamTwoFactorRequired, type IamUser, type IamUserStatus, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, type KnownShopStep, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LibraryCadence, type LibraryCompleter, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, type LibraryOccurrence, type LibraryOccurrenceRecorded, type LibraryOccurrenceStatus, type LibraryRoutineState, type LibrarySchedule, type LibraryScheduleRule, type LibrarySeason, type LibraryWeekday, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LiveUnread, type LiveUnreadOptions, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketRegion, type MarketRegionsResponse, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportOutcome, type MessageReportReason, type MessageReportStatus, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, type MessagingSide, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationAction, type NotificationCategory, type NotificationFlash, type NotificationLink, type NotificationPref, type NotificationStream, type NotificationStreamFrame, type NotificationStreamItem, type NotificationStreamOptions, type NotificationStreamState, type NotificationStreamTicket, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthClient, type OAuthClientSummary, type OAuthClientTrustLevel, type OAuthClientType, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OidcSigningKey, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderDocument, type OrderDocumentKind, type OrderEvent, type OrderHistoryEntry, type OrderHistoryParams, type OrderItem, type OrderItemSummary, type OrderStatus, OrdersModule, type Organization, type OrganizationKind, type OrganizationStatus, type OrganizationSummary, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PlatformSetting, type PlatformSettingChange, type PlatformSettingDetail, type PlatformSettingGroup, type PlatformSettingKind, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegisterOAuthClientInput, type RegisteredOAuthClient, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveMessageReportInput, type ResolveMessageReportResult, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendTestNotificationResult, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type SettlementLine, type ShareUrlOptions, type ShopCancelReason, type ShopHolder, type ShopNextStep, type ShopOrderFields, type ShopSettlement, type ShopStep, type SilentAuthorizeResult, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateOrganizationInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyIamMethodResult, type VerifyIamTwoFactorInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleReviewStatus, type WholesaleStore, type WishlistListing, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, storeShareUrl };
5851
+ export { APIClient, APIError, type APIErrorResponse, type ActivateIamUserInput, type ActivateIamUserResult, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddIamPasskeyResult, type AddIamTotpResult, type AddIamTwoFactorMethodInput, type AddPaymentMethodInput, type AddPayoutDestinationInput, type Address, type AdminAuditActor, type AdminAuditEntry, type AdminAuditQuery, type AdminAuthStrength, type AdminListingItem, type AdminMessageReport, type AdminMessageReportDetail, type AdminMessageReportList, type AdminMessageReportThreadMessage, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CancelCheckoutRefusalCode, type CancelCheckoutResponse, type CancelOrderInput, type CancelOrderResult, type CartItem, type CartLineAvailability, CartModule, type CartPartition, type CategoriesBySection, type Category, type CategorySection, type ChangePasswordInput, type ChangePlatformSettingInput, type ChangePlatformSettingResult, type Checkout, type CheckoutMoney, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutRefusal, type CheckoutRefusalCode, type CheckoutShopOrder, type CheckoutState, type CheckoutStatus, type CheckoutStatusResponse, CheckoutsModule, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateCheckoutInput, type CreateCheckoutResponse, type CreateIamUserInput, type CreateIamUserResult, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, type CreateOrganizationInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, type CreatedBaleOrder, type CursorPage, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EarningsBalance, type EmailLoginInput, type EmailRegisterInput, type FileResponse, type FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, type GetCheckoutResponse, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, type IamSession, type IamSessionsResult, type IamSignIn, type IamSignInFailureReason, type IamSignInsResult, type IamTokens, type IamTwoFactorRequired, type IamUser, type IamUserStatus, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type Jwk, type Jwks, type KnownPaymentProvider, type KnownShopStep, LISTING_STATUSES, type LegacyLinkResolution, type LegacyMessageArchiveSummary, type LegacyMessagePage, type LegacyMessageRecord, type LibraryCadence, type LibraryCompleter, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, type LibraryOccurrence, type LibraryOccurrenceRecorded, type LibraryOccurrenceStatus, type LibraryRoutineState, type LibrarySchedule, type LibraryScheduleRule, type LibrarySeason, type LibraryWeekday, type LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LiveUnread, type LiveUnreadOptions, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketRegion, type MarketRegionsResponse, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportOutcome, type MessageReportReason, type MessageReportStatus, type MessageResponse, MessagesModule, type MessagesRealtimeConnection, type MessagesRealtimeEnvelope, type MessagesRealtimeEvent, type MessagesRealtimeOptions, type MessagesRealtimeState, type MessagesRealtimeTicket, type MessagingBlockInput, type MessagingBlockRemovedResult, type MessagingBlockResult, type MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, type MessagingSide, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationAction, type NotificationCategory, type NotificationFlash, type NotificationLink, type NotificationPref, type NotificationStream, type NotificationStreamFrame, type NotificationStreamItem, type NotificationStreamOptions, type NotificationStreamState, type NotificationStreamTicket, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthClient, type OAuthClientSummary, type OAuthClientTrustLevel, type OAuthClientType, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OidcSigningKey, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderDocument, type OrderDocumentKind, type OrderEvent, type OrderHistoryEntry, type OrderHistoryParams, type OrderItem, type OrderItemSummary, type OrderStatus, OrdersModule, type Organization, type OrganizationKind, type OrganizationStatus, type OrganizationSummary, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PayoutBankOption, type PayoutDestination, type PayoutDestinationLabel, type PayoutDestinationRejection, type PayoutDestinations, type PayoutDestinationsState, type PayoutMethodOption, type PayoutMethodType, type PayoutState, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PlatformSetting, type PlatformSettingChange, type PlatformSettingDetail, type PlatformSettingGroup, type PlatformSettingKind, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegisterOAuthClientInput, type RegisteredOAuthClient, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type ResolveMessageReportInput, type ResolveMessageReportResult, type ResolveThreadResult, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type SendTestNotificationResult, type SendThreadMessageInput, type SendThreadMessageResult, type Session, SettingsModule, type SettlementLine, type ShareUrlOptions, type ShopCancelReason, type ShopEarnings, type ShopHolder, type ShopNextStep, type ShopOrderFields, type ShopPayout, type ShopPayoutEntriesPage, type ShopPayoutEntriesParams, type ShopPayoutEntry, type ShopSettlement, type ShopStep, type SilentAuthorizeResult, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreResolveThreadInput, type StoreReviewsPage, type StoreSettings, type StoreStats, type StoreSummary, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type ThreadCard, type ThreadId, type ThreadMessage, type ThreadSubject, type ThreadSystemEvent, type ThreadTimelineItem, type ThreadTimelineItemId, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateConversationPreferencesInput, type UpdateListingInput, type UpdateOrganizationInput, type UpdateProfileInput, type UpdateStoreInput, type UpdateThreadPreferencesInput, UploadsModule, type UserInfo, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyIamMethodResult, type VerifyIamTwoFactorInput, type VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleReviewStatus, type WholesaleStore, type WishlistListing, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, stepUpRequired, storeShareUrl };
package/dist/index.js CHANGED
@@ -2391,7 +2391,91 @@ var StoresModule = class {
2391
2391
  async delete(storeId, options) {
2392
2392
  return this.client.delete(`/listings/stores/${storeId}`, void 0, options);
2393
2393
  }
2394
+ /**
2395
+ * A shop's earnings: per currency, what is in escrow, on hold, awaiting approval, approved,
2396
+ * sending, sent, failed or a test, in minor units. The owner, or a team member who may read
2397
+ * earnings.
2398
+ *
2399
+ * Errors: 403 forbidden (a member whose role does not include earnings); 404 not_found.
2400
+ */
2401
+ async getEarnings(storeId, options) {
2402
+ return this.client.get(`/orders/stores/${encodeURIComponent(storeId)}/earnings`, void 0, options);
2403
+ }
2404
+ /**
2405
+ * Each paid order's entitlement, newest first, 20 per page, optionally of one state.
2406
+ *
2407
+ * Errors: 400 invalid_input (unknown state); 403 forbidden; 404 not_found.
2408
+ */
2409
+ async getEarningsEntries(storeId, params, options) {
2410
+ return this.client.get(
2411
+ `/orders/stores/${encodeURIComponent(storeId)}/earnings/entries`,
2412
+ params,
2413
+ options
2414
+ );
2415
+ }
2416
+ /**
2417
+ * One payout of the shop, with the settlement lines that explain it.
2418
+ *
2419
+ * Errors: 403 forbidden; 404 not_found.
2420
+ */
2421
+ async getPayout(storeId, payoutId, options) {
2422
+ return this.client.get(
2423
+ `/orders/stores/${encodeURIComponent(storeId)}/payouts/${encodeURIComponent(payoutId)}`,
2424
+ void 0,
2425
+ options
2426
+ );
2427
+ }
2428
+ /**
2429
+ * Where the shop is paid: its destinations, masked, with the methods and banks on offer. The
2430
+ * owner, or a team member who may read earnings.
2431
+ *
2432
+ * Errors: 403 store_forbidden.
2433
+ */
2434
+ async getPayoutDestinations(storeId, options) {
2435
+ return this.client.get(`/listings/stores/${encodeURIComponent(storeId)}/payout-destinations`, void 0, options);
2436
+ }
2437
+ /**
2438
+ * Owner: add a payout destination. The shop's first applies at once; every later one, and a change
2439
+ * of default, 48 hours later. Needs a second factor used in the last 10 minutes.
2440
+ *
2441
+ * Errors: 400 invalid_input, or a `PayoutDestinationRejection` with `field`; 403 store_forbidden,
2442
+ * step_up_required; 409 method_unavailable, destination_exists, too_many_destinations.
2443
+ */
2444
+ async addPayoutDestination(storeId, input, options) {
2445
+ return this.client.post(`/listings/stores/${encodeURIComponent(storeId)}/payout-destinations`, input, options);
2446
+ }
2447
+ /**
2448
+ * Owner: make a destination the default, 48 hours from now. Choosing the current default again
2449
+ * cancels any pending change. Needs a recent second factor.
2450
+ *
2451
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
2452
+ */
2453
+ async setDefaultPayoutDestination(storeId, destinationId, options) {
2454
+ return this.client.post(this.destinationPath(storeId, destinationId, "/default"), void 0, options);
2455
+ }
2456
+ /**
2457
+ * Owner: cancel a pending change of default to this destination. Needs a recent second factor.
2458
+ *
2459
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found; 409 no_pending_default.
2460
+ */
2461
+ async cancelPendingDefault(storeId, destinationId, options) {
2462
+ return this.client.delete(this.destinationPath(storeId, destinationId, "/default"), void 0, options);
2463
+ }
2464
+ /**
2465
+ * Owner: remove a destination, or cancel one still cooling off. Needs a recent second factor.
2466
+ *
2467
+ * Errors: 403 store_forbidden, step_up_required; 404 not_found.
2468
+ */
2469
+ async removePayoutDestination(storeId, destinationId, options) {
2470
+ return this.client.delete(this.destinationPath(storeId, destinationId, ""), void 0, options);
2471
+ }
2472
+ destinationPath(storeId, destinationId, suffix) {
2473
+ return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
2474
+ }
2394
2475
  };
2476
+ function stepUpRequired(error) {
2477
+ return error instanceof APIError && error.code === "step_up_required";
2478
+ }
2395
2479
 
2396
2480
  // src/modules/reviews.ts
2397
2481
  var ReviewsModule = class {
@@ -3820,6 +3904,7 @@ exports.maskPhone = maskPhone;
3820
3904
  exports.normalizePhone = normalizePhone;
3821
3905
  exports.partitionCart = partitionCart;
3822
3906
  exports.regionById = regionById;
3907
+ exports.stepUpRequired = stepUpRequired;
3823
3908
  exports.storeShareUrl = storeShareUrl;
3824
3909
  //# sourceMappingURL=index.js.map
3825
3910
  //# sourceMappingURL=index.js.map