@mitumba/sdk 5.29.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.ts CHANGED
@@ -2254,6 +2254,70 @@ interface OrderHistoryEntry extends Order {
2254
2254
  checkout_id: string | null;
2255
2255
  /** That checkout's invoice number. */
2256
2256
  invoice_number: string | null;
2257
+ /** With `role: 'seller'`: what the order needs next, from the shop's side. */
2258
+ next_step?: ShopNextStep;
2259
+ }
2260
+ /** Who an order is waiting on, from the shop's side. */
2261
+ type ShopHolder = 'shop' | 'courier' | 'buyer' | 'mitumba' | 'done';
2262
+ /** The one next step of an order, from the shop's side. Open: an unknown step reads as waiting. */
2263
+ type KnownShopStep = 'awaiting_payment' | 'confirm_available' | 'get_ready' | 'hand_over_counter' | 'drop_off' | 'await_collection' | 'mark_shipped' | 'in_transit' | 'buyer_window' | 'respond_dispute' | 'dispute_review' | 'parcel_problem' | 'completed' | 'cancelled';
2264
+ type ShopStep = KnownShopStep | (string & {});
2265
+ interface ShopNextStep {
2266
+ holder: ShopHolder;
2267
+ step: ShopStep;
2268
+ /** When the step must be done by (ISO 8601), or `null` when nothing is due. */
2269
+ deadline: string | null;
2270
+ }
2271
+ /** A line of a settlement, signed, in minor units. */
2272
+ interface SettlementLine {
2273
+ /** e.g. `item`, `commission`, `commission_vat`, `deliver_for_me`, `counter_fare`. Open. */
2274
+ kind: string;
2275
+ amount_minor: number;
2276
+ }
2277
+ /** What the shop receives for an order. */
2278
+ interface ShopSettlement {
2279
+ currency: string;
2280
+ lines: SettlementLine[];
2281
+ /** What the shop receives, in minor units. */
2282
+ receive_minor: number;
2283
+ /** `true` once the payout exists and its lines are final; `false` for an estimate. */
2284
+ final: boolean;
2285
+ }
2286
+ /** One line of an order, in full, on the shop's view of the order. */
2287
+ interface OrderItem {
2288
+ listing_id: string;
2289
+ title: string | null;
2290
+ image_url: string | null;
2291
+ quantity: number;
2292
+ /** The unit price, in whole units of the order's currency. */
2293
+ price: number;
2294
+ }
2295
+ /** The fields the shop's view of an order adds (`GET /orders/:id` for the seller or a team member). */
2296
+ interface ShopOrderFields {
2297
+ items: OrderItem[];
2298
+ /** `null` for a cancelled order. */
2299
+ settlement: ShopSettlement | null;
2300
+ next_step: ShopNextStep;
2301
+ }
2302
+ /** Why the shop cancels a paid order. */
2303
+ type ShopCancelReason = 'sold_elsewhere' | 'damaged' | 'other';
2304
+ interface CancelOrderInput {
2305
+ reason: ShopCancelReason;
2306
+ /** Shown to the buyer, up to 500 characters. */
2307
+ note?: string;
2308
+ }
2309
+ interface CancelOrderResult {
2310
+ order_id: string;
2311
+ status: 'cancelled';
2312
+ /** What the buyer is owed back, in whole units. */
2313
+ refund: {
2314
+ id: string;
2315
+ amount: number;
2316
+ currency: string;
2317
+ status: 'pending' | 'sent' | 'failed';
2318
+ };
2319
+ /** When this cancellation paused the shop, the pause's end; otherwise `null`. */
2320
+ shop_paused_until: string | null;
2257
2321
  }
2258
2322
  /** Which document an order has: its invoice while it awaits payment, its receipt once it is paid. */
2259
2323
  type OrderDocumentKind = 'invoice' | 'receipt';
@@ -2864,9 +2928,13 @@ interface StoreSettings {
2864
2928
  bus_partners: string[];
2865
2929
  delivery_days_min: number;
2866
2930
  delivery_days_max: number;
2931
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2867
2932
  payout_method: 'mpesa' | 'bank';
2933
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2868
2934
  payout_mpesa_number: string | null;
2935
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2869
2936
  payout_bank_name: string | null;
2937
+ /** @deprecated Read only and no longer used for payouts. Use `stores.getPayoutDestinations`. Updates ignore it. */
2870
2938
  payout_account_number: string | null;
2871
2939
  payout_frequency: 'instant' | 'daily' | 'weekly';
2872
2940
  accept_returns: boolean;
@@ -2922,6 +2990,140 @@ interface StoreAnalytics {
2922
2990
  };
2923
2991
  }
2924
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
+
2925
3127
  interface Review {
2926
3128
  id: string;
2927
3129
  store_id: string;
@@ -4156,11 +4358,20 @@ declare class OrdersModule {
4156
4358
  delivery_fee: number;
4157
4359
  }>;
4158
4360
  /**
4159
- * Get full details of an order, including its event timeline.
4361
+ * Get full details of an order, including its event timeline. For the shop (the seller, or a team
4362
+ * member who may read orders) it also carries `items`, `settlement` and `next_step`.
4160
4363
  */
4161
4364
  getById(id: string, options?: RequestOptions): Promise<Order & {
4162
4365
  events: OrderEvent[];
4163
- }>;
4366
+ } & Partial<ShopOrderFields>>;
4367
+ /**
4368
+ * Shop: cancel a paid order it cannot fulfil, before its parcel is ready. The buyer is refunded in
4369
+ * full. The owner or a team member who may cancel orders.
4370
+ *
4371
+ * Errors: 400 invalid_input; 403 store_forbidden; 404 not_found; 409 order_not_cancellable,
4372
+ * parcel_ready, not_refundable, conflict (reload and retry).
4373
+ */
4374
+ cancel(id: string, input: CancelOrderInput, options?: RequestOptions): Promise<CancelOrderResult>;
4164
4375
  /**
4165
4376
  * Transition the status of an order.
4166
4377
  */
@@ -4442,7 +4653,64 @@ declare class StoresModule {
4442
4653
  blocked: true;
4443
4654
  reasons: string[];
4444
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;
4445
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;
4446
4714
 
4447
4715
  declare class ReviewsModule {
4448
4716
  private readonly client;
@@ -5580,4 +5848,4 @@ declare class MitumbaClient {
5580
5848
  isAuthenticated(): Promise<boolean>;
5581
5849
  }
5582
5850
 
5583
- 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 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, 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 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 ShareUrlOptions, 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
@@ -1143,11 +1143,22 @@ var OrdersModule = class {
1143
1143
  return this.client.post("/orders", input, options);
1144
1144
  }
1145
1145
  /**
1146
- * Get full details of an order, including its event timeline.
1146
+ * Get full details of an order, including its event timeline. For the shop (the seller, or a team
1147
+ * member who may read orders) it also carries `items`, `settlement` and `next_step`.
1147
1148
  */
1148
1149
  async getById(id, options) {
1149
1150
  return this.client.get(`/orders/${id}`, void 0, options);
1150
1151
  }
1152
+ /**
1153
+ * Shop: cancel a paid order it cannot fulfil, before its parcel is ready. The buyer is refunded in
1154
+ * full. The owner or a team member who may cancel orders.
1155
+ *
1156
+ * Errors: 400 invalid_input; 403 store_forbidden; 404 not_found; 409 order_not_cancellable,
1157
+ * parcel_ready, not_refundable, conflict (reload and retry).
1158
+ */
1159
+ async cancel(id, input, options) {
1160
+ return this.client.post(`/orders/${encodeURIComponent(id)}/cancel`, input, options);
1161
+ }
1151
1162
  /**
1152
1163
  * Transition the status of an order.
1153
1164
  */
@@ -2380,7 +2391,91 @@ var StoresModule = class {
2380
2391
  async delete(storeId, options) {
2381
2392
  return this.client.delete(`/listings/stores/${storeId}`, void 0, options);
2382
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
+ }
2383
2475
  };
2476
+ function stepUpRequired(error) {
2477
+ return error instanceof APIError && error.code === "step_up_required";
2478
+ }
2384
2479
 
2385
2480
  // src/modules/reviews.ts
2386
2481
  var ReviewsModule = class {
@@ -3809,6 +3904,7 @@ exports.maskPhone = maskPhone;
3809
3904
  exports.normalizePhone = normalizePhone;
3810
3905
  exports.partitionCart = partitionCart;
3811
3906
  exports.regionById = regionById;
3907
+ exports.stepUpRequired = stepUpRequired;
3812
3908
  exports.storeShareUrl = storeShareUrl;
3813
3909
  //# sourceMappingURL=index.js.map
3814
3910
  //# sourceMappingURL=index.js.map