@mitumba/sdk 5.8.0 → 5.10.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
@@ -1042,14 +1042,42 @@ interface AdminOperator {
1042
1042
  display_name: string | null;
1043
1043
  permissions: OperatorPermissionGrant[];
1044
1044
  }
1045
+ /** Who performed an audited action, resolved from its operator subject. */
1046
+ interface AdminAuditActor {
1047
+ /** `user`: root / platform operator (users.id). `iam`: an IAM principal. `unknown`: not resolvable. */
1048
+ type: 'user' | 'iam' | 'unknown';
1049
+ email: string | null;
1050
+ display_name: string | null;
1051
+ /** The IAM principal's organization; null for platform operators. */
1052
+ organization: {
1053
+ id: string;
1054
+ alias: string | null;
1055
+ name: string | null;
1056
+ } | null;
1057
+ }
1045
1058
  interface AdminAuditEntry {
1046
1059
  id: string;
1060
+ /** Operator subject: users.id or iam:<iam_users.id>. */
1047
1061
  actor_id: string;
1048
1062
  action: string;
1049
1063
  target_type: string;
1050
- target_id: string;
1064
+ target_id: string | null;
1051
1065
  detail: string | null;
1052
1066
  created_at: string;
1067
+ /** Present from the attributed audit trail onward. */
1068
+ actor?: AdminAuditActor;
1069
+ }
1070
+ /** Filters for {@link AdminModule.listAuditLog}. All exact matches; `since`/`until` are ISO timestamps. */
1071
+ interface AdminAuditQuery {
1072
+ limit?: number;
1073
+ actor?: string;
1074
+ action?: string;
1075
+ target_type?: string;
1076
+ target_id?: string;
1077
+ since?: string;
1078
+ until?: string;
1079
+ /** `next_cursor` from the previous page. */
1080
+ before?: string;
1053
1081
  }
1054
1082
  interface PendingPayoutApproval {
1055
1083
  id: string;
@@ -2084,6 +2112,24 @@ interface MarketsResponse {
2084
2112
  markets: Market[];
2085
2113
  updated_at: string;
2086
2114
  }
2115
+ /** A first-level administrative region of a market, e.g. a county in Kenya. */
2116
+ interface MarketRegion {
2117
+ /** Stable lowercase slug, e.g. `"trans-nzoia"`. */
2118
+ id: string;
2119
+ /** The canonical name the platform stores, e.g. `"Trans-Nzoia"`. Send this, not free text. */
2120
+ name: string;
2121
+ }
2122
+ interface MarketRegionsResponse {
2123
+ version: 1;
2124
+ /** UPPERCASE ISO 3166-1 alpha-2, e.g. `"KE"`. */
2125
+ market_code: string;
2126
+ /** Singular and plural labels for the region field, e.g. County / Counties. */
2127
+ label: string;
2128
+ plural: string;
2129
+ /** Regions in display (alphabetical) order. */
2130
+ regions: MarketRegion[];
2131
+ updated_at: string;
2132
+ }
2087
2133
 
2088
2134
  interface VAZIOutfitItem {
2089
2135
  id: string;
@@ -4111,6 +4157,14 @@ declare class AdminModule {
4111
4157
  getAuditLog(limit?: number, options?: RequestOptions): Promise<{
4112
4158
  entries: AdminAuditEntry[];
4113
4159
  }>;
4160
+ /**
4161
+ * The attributed, filterable audit trail, newest first. Pass `next_cursor` back as `before` for
4162
+ * the next page; it is null on the last page.
4163
+ */
4164
+ listAuditLog(query?: AdminAuditQuery, options?: RequestOptions): Promise<{
4165
+ entries: AdminAuditEntry[];
4166
+ next_cursor: string | null;
4167
+ }>;
4114
4168
  listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
4115
4169
  payouts: PendingPayoutApproval[];
4116
4170
  }>;
@@ -4441,6 +4495,15 @@ declare class MarketsModule {
4441
4495
  * (`formatMoney`, `normalizePhone`, `findMarket`, ...).
4442
4496
  */
4443
4497
  list(options?: RequestOptions): Promise<MarketsResponse>;
4498
+ /**
4499
+ * The first-level regions of one market, e.g. Kenya's 47 counties, with the market's label for
4500
+ * them (`County` / `Counties`). Use this for every county or region picker, and send the
4501
+ * returned `name` back to the API: it is the canonical spelling the platform stores.
4502
+ *
4503
+ * `code` is an ISO 3166-1 alpha-2 market code (`"KE"`); it is uppercased before sending.
4504
+ * Public and cacheable. An unknown market rejects with a 404 rather than resolving empty.
4505
+ */
4506
+ regions(code: string, options?: RequestOptions): Promise<MarketRegionsResponse>;
4444
4507
  }
4445
4508
 
4446
4509
  /**
@@ -4493,6 +4556,14 @@ declare function maskPhone(value: string, market: PhoneMarket): string;
4493
4556
  declare function findMarket(markets: readonly Market[], code: string): Market | undefined;
4494
4557
  /** Markets that can transact. A `coming_soon` market is for discovery only. */
4495
4558
  declare function activeMarkets(markets: readonly Market[]): Market[];
4559
+ /**
4560
+ * Find a region by its canonical name in a list read from `sdk.markets.regions(code)`. Surrounding
4561
+ * whitespace is ignored; everything else must match exactly, so a stored value is always one the
4562
+ * platform accepts. Use it to preselect a saved region in a picker.
4563
+ */
4564
+ declare function findRegion(regions: readonly MarketRegion[], name: string): MarketRegion | undefined;
4565
+ /** Find a region by its stable id slug, e.g. `"trans-nzoia"`. */
4566
+ declare function regionById(regions: readonly MarketRegion[], id: string): MarketRegion | undefined;
4496
4567
 
4497
4568
  /**
4498
4569
  * Canonical go.mitumba.africa share URLs — the one place clients build listing, store and bale share links.
@@ -4572,4 +4643,4 @@ declare class MitumbaClient {
4572
4643
  isAuthenticated(): Promise<boolean>;
4573
4644
  }
4574
4645
 
4575
- 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 AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, 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 CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, 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 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 FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, 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 LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, 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, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, 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 PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, 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 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, createTokenStore, findMarket, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, storeShareUrl };
4646
+ 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, 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 CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, 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 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 FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, 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 LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, 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 MessageReportReason, 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, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, 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 PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, 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 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, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, regionById, storeShareUrl };
package/dist/index.d.ts CHANGED
@@ -1042,14 +1042,42 @@ interface AdminOperator {
1042
1042
  display_name: string | null;
1043
1043
  permissions: OperatorPermissionGrant[];
1044
1044
  }
1045
+ /** Who performed an audited action, resolved from its operator subject. */
1046
+ interface AdminAuditActor {
1047
+ /** `user`: root / platform operator (users.id). `iam`: an IAM principal. `unknown`: not resolvable. */
1048
+ type: 'user' | 'iam' | 'unknown';
1049
+ email: string | null;
1050
+ display_name: string | null;
1051
+ /** The IAM principal's organization; null for platform operators. */
1052
+ organization: {
1053
+ id: string;
1054
+ alias: string | null;
1055
+ name: string | null;
1056
+ } | null;
1057
+ }
1045
1058
  interface AdminAuditEntry {
1046
1059
  id: string;
1060
+ /** Operator subject: users.id or iam:<iam_users.id>. */
1047
1061
  actor_id: string;
1048
1062
  action: string;
1049
1063
  target_type: string;
1050
- target_id: string;
1064
+ target_id: string | null;
1051
1065
  detail: string | null;
1052
1066
  created_at: string;
1067
+ /** Present from the attributed audit trail onward. */
1068
+ actor?: AdminAuditActor;
1069
+ }
1070
+ /** Filters for {@link AdminModule.listAuditLog}. All exact matches; `since`/`until` are ISO timestamps. */
1071
+ interface AdminAuditQuery {
1072
+ limit?: number;
1073
+ actor?: string;
1074
+ action?: string;
1075
+ target_type?: string;
1076
+ target_id?: string;
1077
+ since?: string;
1078
+ until?: string;
1079
+ /** `next_cursor` from the previous page. */
1080
+ before?: string;
1053
1081
  }
1054
1082
  interface PendingPayoutApproval {
1055
1083
  id: string;
@@ -2084,6 +2112,24 @@ interface MarketsResponse {
2084
2112
  markets: Market[];
2085
2113
  updated_at: string;
2086
2114
  }
2115
+ /** A first-level administrative region of a market, e.g. a county in Kenya. */
2116
+ interface MarketRegion {
2117
+ /** Stable lowercase slug, e.g. `"trans-nzoia"`. */
2118
+ id: string;
2119
+ /** The canonical name the platform stores, e.g. `"Trans-Nzoia"`. Send this, not free text. */
2120
+ name: string;
2121
+ }
2122
+ interface MarketRegionsResponse {
2123
+ version: 1;
2124
+ /** UPPERCASE ISO 3166-1 alpha-2, e.g. `"KE"`. */
2125
+ market_code: string;
2126
+ /** Singular and plural labels for the region field, e.g. County / Counties. */
2127
+ label: string;
2128
+ plural: string;
2129
+ /** Regions in display (alphabetical) order. */
2130
+ regions: MarketRegion[];
2131
+ updated_at: string;
2132
+ }
2087
2133
 
2088
2134
  interface VAZIOutfitItem {
2089
2135
  id: string;
@@ -4111,6 +4157,14 @@ declare class AdminModule {
4111
4157
  getAuditLog(limit?: number, options?: RequestOptions): Promise<{
4112
4158
  entries: AdminAuditEntry[];
4113
4159
  }>;
4160
+ /**
4161
+ * The attributed, filterable audit trail, newest first. Pass `next_cursor` back as `before` for
4162
+ * the next page; it is null on the last page.
4163
+ */
4164
+ listAuditLog(query?: AdminAuditQuery, options?: RequestOptions): Promise<{
4165
+ entries: AdminAuditEntry[];
4166
+ next_cursor: string | null;
4167
+ }>;
4114
4168
  listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
4115
4169
  payouts: PendingPayoutApproval[];
4116
4170
  }>;
@@ -4441,6 +4495,15 @@ declare class MarketsModule {
4441
4495
  * (`formatMoney`, `normalizePhone`, `findMarket`, ...).
4442
4496
  */
4443
4497
  list(options?: RequestOptions): Promise<MarketsResponse>;
4498
+ /**
4499
+ * The first-level regions of one market, e.g. Kenya's 47 counties, with the market's label for
4500
+ * them (`County` / `Counties`). Use this for every county or region picker, and send the
4501
+ * returned `name` back to the API: it is the canonical spelling the platform stores.
4502
+ *
4503
+ * `code` is an ISO 3166-1 alpha-2 market code (`"KE"`); it is uppercased before sending.
4504
+ * Public and cacheable. An unknown market rejects with a 404 rather than resolving empty.
4505
+ */
4506
+ regions(code: string, options?: RequestOptions): Promise<MarketRegionsResponse>;
4444
4507
  }
4445
4508
 
4446
4509
  /**
@@ -4493,6 +4556,14 @@ declare function maskPhone(value: string, market: PhoneMarket): string;
4493
4556
  declare function findMarket(markets: readonly Market[], code: string): Market | undefined;
4494
4557
  /** Markets that can transact. A `coming_soon` market is for discovery only. */
4495
4558
  declare function activeMarkets(markets: readonly Market[]): Market[];
4559
+ /**
4560
+ * Find a region by its canonical name in a list read from `sdk.markets.regions(code)`. Surrounding
4561
+ * whitespace is ignored; everything else must match exactly, so a stored value is always one the
4562
+ * platform accepts. Use it to preselect a saved region in a picker.
4563
+ */
4564
+ declare function findRegion(regions: readonly MarketRegion[], name: string): MarketRegion | undefined;
4565
+ /** Find a region by its stable id slug, e.g. `"trans-nzoia"`. */
4566
+ declare function regionById(regions: readonly MarketRegion[], id: string): MarketRegion | undefined;
4496
4567
 
4497
4568
  /**
4498
4569
  * Canonical go.mitumba.africa share URLs — the one place clients build listing, store and bale share links.
@@ -4572,4 +4643,4 @@ declare class MitumbaClient {
4572
4643
  isAuthenticated(): Promise<boolean>;
4573
4644
  }
4574
4645
 
4575
- 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 AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, 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 CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, 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 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 FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, 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 LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, type Market, type MarketCurrency, type MarketPhone, type MarketStatus, MarketsModule, type MarketsResponse, MemoryTokenStore, type Message, type MessageAttachment, type MessageAuthor, type MessageId, type MessagePage, type MessageReportReason, 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, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, 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 PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, 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 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, createTokenStore, findMarket, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, storeShareUrl };
4646
+ 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, 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 CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, 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 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 FinishIamPasskeyEnrollmentInput, type FinishIamPasskeyLoginInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type IamActivation, type IamLoginInput, type IamLoginMethod, type IamMethodsResult, IamModule, type IamPasskeyLoginOptions, type IamProfile, 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 LinkedAccount, type LinkedAccountProvider, type ListConversationsParams, type ListIamUsersResult, type ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, 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 MessageReportReason, 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, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, type OAuthAuthorizeInput, type OAuthAuthorizeResult, type OAuthConsent, type OAuthConsentInput, type OAuthConsentRequired, type OAuthConsentRevokeResult, OAuthModule, type OAuthTokenExchangeInput, type OAuthTokenResult, ORDER_STATUSES, type OpenIdConfiguration, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, 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 PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type ReadCursorResult, RealtimeProtocolError, RealtimeUnavailableError, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegenerateIamBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, 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 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, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, regionById, storeShareUrl };
package/dist/index.js CHANGED
@@ -2380,6 +2380,13 @@ var AdminModule = class {
2380
2380
  async getAuditLog(limit = 100, options) {
2381
2381
  return this.client.get("/admin/audit", { limit }, options);
2382
2382
  }
2383
+ /**
2384
+ * The attributed, filterable audit trail, newest first. Pass `next_cursor` back as `before` for
2385
+ * the next page; it is null on the last page.
2386
+ */
2387
+ async listAuditLog(query2 = {}, options) {
2388
+ return this.client.get("/admin/audit", query2, options);
2389
+ }
2383
2390
  // ── Payout approval ──
2384
2391
  async listPayoutsAwaitingApproval(options) {
2385
2392
  return this.client.get("/admin/payouts/pending-approval", void 0, options);
@@ -2785,6 +2792,18 @@ var MarketsModule = class {
2785
2792
  async list(options) {
2786
2793
  return this.client.get("/markets", void 0, options);
2787
2794
  }
2795
+ /**
2796
+ * The first-level regions of one market, e.g. Kenya's 47 counties, with the market's label for
2797
+ * them (`County` / `Counties`). Use this for every county or region picker, and send the
2798
+ * returned `name` back to the API: it is the canonical spelling the platform stores.
2799
+ *
2800
+ * `code` is an ISO 3166-1 alpha-2 market code (`"KE"`); it is uppercased before sending.
2801
+ * Public and cacheable. An unknown market rejects with a 404 rather than resolving empty.
2802
+ */
2803
+ async regions(code, options) {
2804
+ const marketCode = encodeURIComponent(code.trim().toUpperCase());
2805
+ return this.client.get(`/markets/${marketCode}/regions`, void 0, options);
2806
+ }
2788
2807
  };
2789
2808
 
2790
2809
  // src/types/auth.ts
@@ -2914,6 +2933,14 @@ function findMarket(markets, code) {
2914
2933
  function activeMarkets(markets) {
2915
2934
  return markets.filter((market) => market.status === "active");
2916
2935
  }
2936
+ function findRegion(regions, name) {
2937
+ const input = name.trim();
2938
+ if (!input) return void 0;
2939
+ return regions.find((region) => region.name === input);
2940
+ }
2941
+ function regionById(regions, id) {
2942
+ return regions.find((region) => region.id === id);
2943
+ }
2917
2944
 
2918
2945
  // src/share.ts
2919
2946
  var DEFAULT_SHARE_ORIGIN = "https://go.mitumba.africa";
@@ -3088,6 +3115,7 @@ exports.activeMarkets = activeMarkets;
3088
3115
  exports.baleShareUrl = baleShareUrl;
3089
3116
  exports.createTokenStore = createTokenStore;
3090
3117
  exports.findMarket = findMarket;
3118
+ exports.findRegion = findRegion;
3091
3119
  exports.formatAmount = formatAmount;
3092
3120
  exports.formatMoney = formatMoney;
3093
3121
  exports.formatMoneyCompact = formatMoneyCompact;
@@ -3098,6 +3126,7 @@ exports.isValidPhone = isValidPhone;
3098
3126
  exports.listingShareUrl = listingShareUrl;
3099
3127
  exports.maskPhone = maskPhone;
3100
3128
  exports.normalizePhone = normalizePhone;
3129
+ exports.regionById = regionById;
3101
3130
  exports.storeShareUrl = storeShareUrl;
3102
3131
  //# sourceMappingURL=index.js.map
3103
3132
  //# sourceMappingURL=index.js.map