@mitumba/sdk 5.13.0 → 5.15.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/README.md +1 -1
- package/dist/index.d.mts +120 -2
- package/dist/index.d.ts +120 -2
- package/dist/index.js +92 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +92 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1018,7 +1018,7 @@ interface CreateReportInput {
|
|
|
1018
1018
|
reason: 'counterfeit' | 'offensive' | 'spam' | 'scam' | 'other';
|
|
1019
1019
|
detail?: string;
|
|
1020
1020
|
}
|
|
1021
|
-
type AdminPermission = 'admin:read' | 'users:moderate' | 'ip:block' | 'listings:moderate' | 'orders:transition' | 'payouts:disburse' | 'sellers:verify' | 'recovery:review' | 'broadcast:send' | 'roles:grant' | 'audit:read';
|
|
1021
|
+
type AdminPermission = 'admin:read' | 'users:moderate' | 'ip:block' | 'listings:moderate' | 'orders:transition' | 'payouts:disburse' | 'sellers:verify' | 'recovery:review' | 'broadcast:send' | 'clients:manage' | 'oidc:rotate_keys' | 'roles:grant' | 'audit:read';
|
|
1022
1022
|
type AdminAuthStrength = 'password' | 'sms' | 'email' | 'totp' | 'passkey';
|
|
1023
1023
|
interface AdminRolePreset {
|
|
1024
1024
|
id: string;
|
|
@@ -1113,6 +1113,50 @@ interface AdminWholesalePendingStore {
|
|
|
1113
1113
|
review_note?: string | null;
|
|
1114
1114
|
[key: string]: unknown;
|
|
1115
1115
|
}
|
|
1116
|
+
/** `public` clients (browser SPAs, mobile) use PKCE and have no secret; `confidential` clients have a server-side secret. */
|
|
1117
|
+
type OAuthClientType = 'public' | 'confidential';
|
|
1118
|
+
/** `first_party_implicit` skips the consent screen; `first_party_consent` shows it. */
|
|
1119
|
+
type OAuthClientTrustLevel = 'first_party_implicit' | 'first_party_consent';
|
|
1120
|
+
/** A registered sign-in (relying-party) client as listed by `admin.listOAuthClients()`. Never carries a secret. */
|
|
1121
|
+
interface OAuthClientSummary {
|
|
1122
|
+
client_id: string;
|
|
1123
|
+
name: string;
|
|
1124
|
+
client_type: OAuthClientType;
|
|
1125
|
+
trust_level: OAuthClientTrustLevel;
|
|
1126
|
+
is_active: boolean;
|
|
1127
|
+
created_at: string;
|
|
1128
|
+
updated_at: string;
|
|
1129
|
+
}
|
|
1130
|
+
/** A client with its exact-match redirect-URI allow-list and permitted scopes. */
|
|
1131
|
+
interface OAuthClient extends OAuthClientSummary {
|
|
1132
|
+
redirect_uris: string[];
|
|
1133
|
+
scopes: string[];
|
|
1134
|
+
}
|
|
1135
|
+
interface RegisterOAuthClientInput {
|
|
1136
|
+
name: string;
|
|
1137
|
+
client_type: OAuthClientType;
|
|
1138
|
+
trust_level: OAuthClientTrustLevel;
|
|
1139
|
+
/** Exact-match allow-list. Can be set later with `setOAuthClientRedirectUris()`. */
|
|
1140
|
+
redirect_uris?: string[];
|
|
1141
|
+
/** Scopes the client may request. Can be set later with `setOAuthClientScopes()`. */
|
|
1142
|
+
scopes?: string[];
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* A newly registered client. `client_secret` is present only for a confidential client and is
|
|
1146
|
+
* returned exactly once — it is stored hashed and can never be read back.
|
|
1147
|
+
*/
|
|
1148
|
+
interface RegisteredOAuthClient extends OAuthClient {
|
|
1149
|
+
client_secret?: string;
|
|
1150
|
+
}
|
|
1151
|
+
/** One OIDC signing key's metadata. Key material is never exposed. */
|
|
1152
|
+
interface OidcSigningKey {
|
|
1153
|
+
kid: string;
|
|
1154
|
+
alg: string;
|
|
1155
|
+
/** `current` signs; `previous` still verifies (published in JWKS); `retired` is neither. */
|
|
1156
|
+
status: 'current' | 'previous' | 'retired';
|
|
1157
|
+
created_at: string;
|
|
1158
|
+
rotated_at: string | null;
|
|
1159
|
+
}
|
|
1116
1160
|
|
|
1117
1161
|
interface AuthTokens {
|
|
1118
1162
|
access_token: string;
|
|
@@ -1815,6 +1859,16 @@ interface OrderHistoryParams {
|
|
|
1815
1859
|
store_id?: string;
|
|
1816
1860
|
page?: number;
|
|
1817
1861
|
}
|
|
1862
|
+
/** Which document an order has: its invoice while it awaits payment, its receipt once it is paid. */
|
|
1863
|
+
type OrderDocumentKind = 'invoice' | 'receipt';
|
|
1864
|
+
/** An order's invoice or receipt, as a PDF. Every order of one checkout has the same document. */
|
|
1865
|
+
interface OrderDocument {
|
|
1866
|
+
kind: OrderDocumentKind;
|
|
1867
|
+
/** The name to save it under, e.g. Mitumba-Receipt-RCT-20261110-C0FFEE00.pdf. */
|
|
1868
|
+
filename: string;
|
|
1869
|
+
/** The PDF (application/pdf). */
|
|
1870
|
+
blob: Blob;
|
|
1871
|
+
}
|
|
1818
1872
|
|
|
1819
1873
|
type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
|
|
1820
1874
|
type BaleType = 'original' | 'sorted';
|
|
@@ -2896,6 +2950,14 @@ interface PaginatedResponse<T> {
|
|
|
2896
2950
|
has_more: boolean;
|
|
2897
2951
|
}
|
|
2898
2952
|
|
|
2953
|
+
/** A successful response whose body is a file rather than JSON. */
|
|
2954
|
+
interface FileResponse {
|
|
2955
|
+
blob: Blob;
|
|
2956
|
+
/** The response's Content-Type, or application/octet-stream when it gave none. */
|
|
2957
|
+
contentType: string;
|
|
2958
|
+
/** Every response header, for metadata such as Content-Disposition. */
|
|
2959
|
+
headers: Headers;
|
|
2960
|
+
}
|
|
2899
2961
|
interface RequestOptions {
|
|
2900
2962
|
signal?: AbortSignal;
|
|
2901
2963
|
/**
|
|
@@ -2948,8 +3010,18 @@ declare class APIClient {
|
|
|
2948
3010
|
hydrate(): Promise<void>;
|
|
2949
3011
|
ensureFreshToken(options?: RequestOptions): Promise<void>;
|
|
2950
3012
|
private request;
|
|
3013
|
+
/**
|
|
3014
|
+
* One request with authentication, proactive and reactive token refresh, retries and error decoding.
|
|
3015
|
+
* Resolves with the successful response, unread, so the caller chooses how to read its body.
|
|
3016
|
+
*/
|
|
3017
|
+
private send;
|
|
2951
3018
|
private handleTokenRefresh;
|
|
2952
3019
|
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<T>;
|
|
3020
|
+
/**
|
|
3021
|
+
* A GET whose response is a file (a PDF, an image) rather than JSON. Authentication, refresh,
|
|
3022
|
+
* retries and errors are exactly those of {@link get}; an error response still decodes its JSON body.
|
|
3023
|
+
*/
|
|
3024
|
+
getFile(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<FileResponse>;
|
|
2953
3025
|
post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2954
3026
|
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2955
3027
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
@@ -3491,6 +3563,13 @@ declare class OrdersModule {
|
|
|
3491
3563
|
ok: boolean;
|
|
3492
3564
|
status: OrderStatus;
|
|
3493
3565
|
}>;
|
|
3566
|
+
/**
|
|
3567
|
+
* Get an order's invoice or receipt as a PDF: its receipt once it is paid, its invoice while it awaits
|
|
3568
|
+
* payment. Buyer only. Every order of one checkout returns the same document.
|
|
3569
|
+
*
|
|
3570
|
+
* Errors: 404 document_not_found when the order has no document to show.
|
|
3571
|
+
*/
|
|
3572
|
+
getDocument(id: string, options?: RequestOptions): Promise<OrderDocument>;
|
|
3494
3573
|
/**
|
|
3495
3574
|
* Get the order history for the current authenticated user.
|
|
3496
3575
|
*/
|
|
@@ -4211,6 +4290,45 @@ declare class AdminModule {
|
|
|
4211
4290
|
entries: AdminAuditEntry[];
|
|
4212
4291
|
next_cursor: string | null;
|
|
4213
4292
|
}>;
|
|
4293
|
+
/** Every registered sign-in client, oldest first. Secrets are never included. */
|
|
4294
|
+
listOAuthClients(options?: RequestOptions): Promise<{
|
|
4295
|
+
clients: OAuthClientSummary[];
|
|
4296
|
+
}>;
|
|
4297
|
+
/** One client with its redirect-URI allow-list and permitted scopes. */
|
|
4298
|
+
getOAuthClient(clientId: string, options?: RequestOptions): Promise<OAuthClient>;
|
|
4299
|
+
/**
|
|
4300
|
+
* Register a client. A confidential client's `client_secret` is in this response only — it is
|
|
4301
|
+
* stored hashed and cannot be retrieved again, so hand it to the client's owner immediately.
|
|
4302
|
+
*/
|
|
4303
|
+
registerOAuthClient(input: RegisterOAuthClientInput, options?: RequestOptions): Promise<RegisteredOAuthClient>;
|
|
4304
|
+
/** Stop a client authorising. Clients are deactivated, never deleted, so their history stays auditable. */
|
|
4305
|
+
deactivateOAuthClient(clientId: string, options?: RequestOptions): Promise<{
|
|
4306
|
+
ok: true;
|
|
4307
|
+
is_active: false;
|
|
4308
|
+
}>;
|
|
4309
|
+
/** Replace a client's whole redirect-URI allow-list. URIs match exactly: no wildcards or prefixes. */
|
|
4310
|
+
setOAuthClientRedirectUris(clientId: string, redirectUris: string[], options?: RequestOptions): Promise<{
|
|
4311
|
+
ok: true;
|
|
4312
|
+
redirect_uris: string[];
|
|
4313
|
+
}>;
|
|
4314
|
+
/** Replace the set of scopes a client may request. */
|
|
4315
|
+
setOAuthClientScopes(clientId: string, scopes: string[], options?: RequestOptions): Promise<{
|
|
4316
|
+
ok: true;
|
|
4317
|
+
scopes: string[];
|
|
4318
|
+
}>;
|
|
4319
|
+
/** The signing-key window — current, previous, retired — as metadata only. */
|
|
4320
|
+
listOidcSigningKeys(options?: RequestOptions): Promise<{
|
|
4321
|
+
keys: OidcSigningKey[];
|
|
4322
|
+
}>;
|
|
4323
|
+
/**
|
|
4324
|
+
* Run the rotation ceremony: a new key becomes current, the current key becomes previous (still
|
|
4325
|
+
* verifying), and the old previous is retired. Do not rotate twice within an id_token lifetime
|
|
4326
|
+
* (one hour), or tokens signed by the retired key stop verifying.
|
|
4327
|
+
*/
|
|
4328
|
+
rotateOidcSigningKey(options?: RequestOptions): Promise<{
|
|
4329
|
+
ok: true;
|
|
4330
|
+
kid: string;
|
|
4331
|
+
}>;
|
|
4214
4332
|
listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
|
|
4215
4333
|
payouts: PendingPayoutApproval[];
|
|
4216
4334
|
}>;
|
|
@@ -4689,4 +4807,4 @@ declare class MitumbaClient {
|
|
|
4689
4807
|
isAuthenticated(): Promise<boolean>;
|
|
4690
4808
|
}
|
|
4691
4809
|
|
|
4692
|
-
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 };
|
|
4810
|
+
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 FileResponse, 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 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 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 RegisterOAuthClientInput, type RegisteredOAuthClient, 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
|
@@ -1018,7 +1018,7 @@ interface CreateReportInput {
|
|
|
1018
1018
|
reason: 'counterfeit' | 'offensive' | 'spam' | 'scam' | 'other';
|
|
1019
1019
|
detail?: string;
|
|
1020
1020
|
}
|
|
1021
|
-
type AdminPermission = 'admin:read' | 'users:moderate' | 'ip:block' | 'listings:moderate' | 'orders:transition' | 'payouts:disburse' | 'sellers:verify' | 'recovery:review' | 'broadcast:send' | 'roles:grant' | 'audit:read';
|
|
1021
|
+
type AdminPermission = 'admin:read' | 'users:moderate' | 'ip:block' | 'listings:moderate' | 'orders:transition' | 'payouts:disburse' | 'sellers:verify' | 'recovery:review' | 'broadcast:send' | 'clients:manage' | 'oidc:rotate_keys' | 'roles:grant' | 'audit:read';
|
|
1022
1022
|
type AdminAuthStrength = 'password' | 'sms' | 'email' | 'totp' | 'passkey';
|
|
1023
1023
|
interface AdminRolePreset {
|
|
1024
1024
|
id: string;
|
|
@@ -1113,6 +1113,50 @@ interface AdminWholesalePendingStore {
|
|
|
1113
1113
|
review_note?: string | null;
|
|
1114
1114
|
[key: string]: unknown;
|
|
1115
1115
|
}
|
|
1116
|
+
/** `public` clients (browser SPAs, mobile) use PKCE and have no secret; `confidential` clients have a server-side secret. */
|
|
1117
|
+
type OAuthClientType = 'public' | 'confidential';
|
|
1118
|
+
/** `first_party_implicit` skips the consent screen; `first_party_consent` shows it. */
|
|
1119
|
+
type OAuthClientTrustLevel = 'first_party_implicit' | 'first_party_consent';
|
|
1120
|
+
/** A registered sign-in (relying-party) client as listed by `admin.listOAuthClients()`. Never carries a secret. */
|
|
1121
|
+
interface OAuthClientSummary {
|
|
1122
|
+
client_id: string;
|
|
1123
|
+
name: string;
|
|
1124
|
+
client_type: OAuthClientType;
|
|
1125
|
+
trust_level: OAuthClientTrustLevel;
|
|
1126
|
+
is_active: boolean;
|
|
1127
|
+
created_at: string;
|
|
1128
|
+
updated_at: string;
|
|
1129
|
+
}
|
|
1130
|
+
/** A client with its exact-match redirect-URI allow-list and permitted scopes. */
|
|
1131
|
+
interface OAuthClient extends OAuthClientSummary {
|
|
1132
|
+
redirect_uris: string[];
|
|
1133
|
+
scopes: string[];
|
|
1134
|
+
}
|
|
1135
|
+
interface RegisterOAuthClientInput {
|
|
1136
|
+
name: string;
|
|
1137
|
+
client_type: OAuthClientType;
|
|
1138
|
+
trust_level: OAuthClientTrustLevel;
|
|
1139
|
+
/** Exact-match allow-list. Can be set later with `setOAuthClientRedirectUris()`. */
|
|
1140
|
+
redirect_uris?: string[];
|
|
1141
|
+
/** Scopes the client may request. Can be set later with `setOAuthClientScopes()`. */
|
|
1142
|
+
scopes?: string[];
|
|
1143
|
+
}
|
|
1144
|
+
/**
|
|
1145
|
+
* A newly registered client. `client_secret` is present only for a confidential client and is
|
|
1146
|
+
* returned exactly once — it is stored hashed and can never be read back.
|
|
1147
|
+
*/
|
|
1148
|
+
interface RegisteredOAuthClient extends OAuthClient {
|
|
1149
|
+
client_secret?: string;
|
|
1150
|
+
}
|
|
1151
|
+
/** One OIDC signing key's metadata. Key material is never exposed. */
|
|
1152
|
+
interface OidcSigningKey {
|
|
1153
|
+
kid: string;
|
|
1154
|
+
alg: string;
|
|
1155
|
+
/** `current` signs; `previous` still verifies (published in JWKS); `retired` is neither. */
|
|
1156
|
+
status: 'current' | 'previous' | 'retired';
|
|
1157
|
+
created_at: string;
|
|
1158
|
+
rotated_at: string | null;
|
|
1159
|
+
}
|
|
1116
1160
|
|
|
1117
1161
|
interface AuthTokens {
|
|
1118
1162
|
access_token: string;
|
|
@@ -1815,6 +1859,16 @@ interface OrderHistoryParams {
|
|
|
1815
1859
|
store_id?: string;
|
|
1816
1860
|
page?: number;
|
|
1817
1861
|
}
|
|
1862
|
+
/** Which document an order has: its invoice while it awaits payment, its receipt once it is paid. */
|
|
1863
|
+
type OrderDocumentKind = 'invoice' | 'receipt';
|
|
1864
|
+
/** An order's invoice or receipt, as a PDF. Every order of one checkout has the same document. */
|
|
1865
|
+
interface OrderDocument {
|
|
1866
|
+
kind: OrderDocumentKind;
|
|
1867
|
+
/** The name to save it under, e.g. Mitumba-Receipt-RCT-20261110-C0FFEE00.pdf. */
|
|
1868
|
+
filename: string;
|
|
1869
|
+
/** The PDF (application/pdf). */
|
|
1870
|
+
blob: Blob;
|
|
1871
|
+
}
|
|
1818
1872
|
|
|
1819
1873
|
type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
|
|
1820
1874
|
type BaleType = 'original' | 'sorted';
|
|
@@ -2896,6 +2950,14 @@ interface PaginatedResponse<T> {
|
|
|
2896
2950
|
has_more: boolean;
|
|
2897
2951
|
}
|
|
2898
2952
|
|
|
2953
|
+
/** A successful response whose body is a file rather than JSON. */
|
|
2954
|
+
interface FileResponse {
|
|
2955
|
+
blob: Blob;
|
|
2956
|
+
/** The response's Content-Type, or application/octet-stream when it gave none. */
|
|
2957
|
+
contentType: string;
|
|
2958
|
+
/** Every response header, for metadata such as Content-Disposition. */
|
|
2959
|
+
headers: Headers;
|
|
2960
|
+
}
|
|
2899
2961
|
interface RequestOptions {
|
|
2900
2962
|
signal?: AbortSignal;
|
|
2901
2963
|
/**
|
|
@@ -2948,8 +3010,18 @@ declare class APIClient {
|
|
|
2948
3010
|
hydrate(): Promise<void>;
|
|
2949
3011
|
ensureFreshToken(options?: RequestOptions): Promise<void>;
|
|
2950
3012
|
private request;
|
|
3013
|
+
/**
|
|
3014
|
+
* One request with authentication, proactive and reactive token refresh, retries and error decoding.
|
|
3015
|
+
* Resolves with the successful response, unread, so the caller chooses how to read its body.
|
|
3016
|
+
*/
|
|
3017
|
+
private send;
|
|
2951
3018
|
private handleTokenRefresh;
|
|
2952
3019
|
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<T>;
|
|
3020
|
+
/**
|
|
3021
|
+
* A GET whose response is a file (a PDF, an image) rather than JSON. Authentication, refresh,
|
|
3022
|
+
* retries and errors are exactly those of {@link get}; an error response still decodes its JSON body.
|
|
3023
|
+
*/
|
|
3024
|
+
getFile(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<FileResponse>;
|
|
2953
3025
|
post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2954
3026
|
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2955
3027
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
@@ -3491,6 +3563,13 @@ declare class OrdersModule {
|
|
|
3491
3563
|
ok: boolean;
|
|
3492
3564
|
status: OrderStatus;
|
|
3493
3565
|
}>;
|
|
3566
|
+
/**
|
|
3567
|
+
* Get an order's invoice or receipt as a PDF: its receipt once it is paid, its invoice while it awaits
|
|
3568
|
+
* payment. Buyer only. Every order of one checkout returns the same document.
|
|
3569
|
+
*
|
|
3570
|
+
* Errors: 404 document_not_found when the order has no document to show.
|
|
3571
|
+
*/
|
|
3572
|
+
getDocument(id: string, options?: RequestOptions): Promise<OrderDocument>;
|
|
3494
3573
|
/**
|
|
3495
3574
|
* Get the order history for the current authenticated user.
|
|
3496
3575
|
*/
|
|
@@ -4211,6 +4290,45 @@ declare class AdminModule {
|
|
|
4211
4290
|
entries: AdminAuditEntry[];
|
|
4212
4291
|
next_cursor: string | null;
|
|
4213
4292
|
}>;
|
|
4293
|
+
/** Every registered sign-in client, oldest first. Secrets are never included. */
|
|
4294
|
+
listOAuthClients(options?: RequestOptions): Promise<{
|
|
4295
|
+
clients: OAuthClientSummary[];
|
|
4296
|
+
}>;
|
|
4297
|
+
/** One client with its redirect-URI allow-list and permitted scopes. */
|
|
4298
|
+
getOAuthClient(clientId: string, options?: RequestOptions): Promise<OAuthClient>;
|
|
4299
|
+
/**
|
|
4300
|
+
* Register a client. A confidential client's `client_secret` is in this response only — it is
|
|
4301
|
+
* stored hashed and cannot be retrieved again, so hand it to the client's owner immediately.
|
|
4302
|
+
*/
|
|
4303
|
+
registerOAuthClient(input: RegisterOAuthClientInput, options?: RequestOptions): Promise<RegisteredOAuthClient>;
|
|
4304
|
+
/** Stop a client authorising. Clients are deactivated, never deleted, so their history stays auditable. */
|
|
4305
|
+
deactivateOAuthClient(clientId: string, options?: RequestOptions): Promise<{
|
|
4306
|
+
ok: true;
|
|
4307
|
+
is_active: false;
|
|
4308
|
+
}>;
|
|
4309
|
+
/** Replace a client's whole redirect-URI allow-list. URIs match exactly: no wildcards or prefixes. */
|
|
4310
|
+
setOAuthClientRedirectUris(clientId: string, redirectUris: string[], options?: RequestOptions): Promise<{
|
|
4311
|
+
ok: true;
|
|
4312
|
+
redirect_uris: string[];
|
|
4313
|
+
}>;
|
|
4314
|
+
/** Replace the set of scopes a client may request. */
|
|
4315
|
+
setOAuthClientScopes(clientId: string, scopes: string[], options?: RequestOptions): Promise<{
|
|
4316
|
+
ok: true;
|
|
4317
|
+
scopes: string[];
|
|
4318
|
+
}>;
|
|
4319
|
+
/** The signing-key window — current, previous, retired — as metadata only. */
|
|
4320
|
+
listOidcSigningKeys(options?: RequestOptions): Promise<{
|
|
4321
|
+
keys: OidcSigningKey[];
|
|
4322
|
+
}>;
|
|
4323
|
+
/**
|
|
4324
|
+
* Run the rotation ceremony: a new key becomes current, the current key becomes previous (still
|
|
4325
|
+
* verifying), and the old previous is retired. Do not rotate twice within an id_token lifetime
|
|
4326
|
+
* (one hour), or tokens signed by the retired key stop verifying.
|
|
4327
|
+
*/
|
|
4328
|
+
rotateOidcSigningKey(options?: RequestOptions): Promise<{
|
|
4329
|
+
ok: true;
|
|
4330
|
+
kid: string;
|
|
4331
|
+
}>;
|
|
4214
4332
|
listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
|
|
4215
4333
|
payouts: PendingPayoutApproval[];
|
|
4216
4334
|
}>;
|
|
@@ -4689,4 +4807,4 @@ declare class MitumbaClient {
|
|
|
4689
4807
|
isAuthenticated(): Promise<boolean>;
|
|
4690
4808
|
}
|
|
4691
4809
|
|
|
4692
|
-
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 };
|
|
4810
|
+
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 FileResponse, 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 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 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 RegisterOAuthClientInput, type RegisteredOAuthClient, 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
|
@@ -281,6 +281,17 @@ var APIClient = class {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
async request(method, path, body, params, options) {
|
|
284
|
+
const response = await this.send(method, path, body, params, options);
|
|
285
|
+
if (response.status === 204) {
|
|
286
|
+
return void 0;
|
|
287
|
+
}
|
|
288
|
+
return response.json();
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* One request with authentication, proactive and reactive token refresh, retries and error decoding.
|
|
292
|
+
* Resolves with the successful response, unread, so the caller chooses how to read its body.
|
|
293
|
+
*/
|
|
294
|
+
async send(method, path, body, params, options) {
|
|
284
295
|
if (!isSessionEndpoint(path)) {
|
|
285
296
|
await this.ensureFreshToken(options);
|
|
286
297
|
}
|
|
@@ -370,10 +381,7 @@ var APIClient = class {
|
|
|
370
381
|
}
|
|
371
382
|
throw new APIError(response.status, normalizeAPIErrorResponse(decoded, response.statusText));
|
|
372
383
|
}
|
|
373
|
-
|
|
374
|
-
return void 0;
|
|
375
|
-
}
|
|
376
|
-
return response.json();
|
|
384
|
+
return response;
|
|
377
385
|
}
|
|
378
386
|
async handleTokenRefresh(signal) {
|
|
379
387
|
if (this.isRefreshing && this.refreshPromise) {
|
|
@@ -425,6 +433,18 @@ var APIClient = class {
|
|
|
425
433
|
get(path, params, options) {
|
|
426
434
|
return this.request("GET", path, void 0, params, options);
|
|
427
435
|
}
|
|
436
|
+
/**
|
|
437
|
+
* A GET whose response is a file (a PDF, an image) rather than JSON. Authentication, refresh,
|
|
438
|
+
* retries and errors are exactly those of {@link get}; an error response still decodes its JSON body.
|
|
439
|
+
*/
|
|
440
|
+
async getFile(path, params, options) {
|
|
441
|
+
const response = await this.send("GET", path, void 0, params, options);
|
|
442
|
+
return {
|
|
443
|
+
blob: await response.blob(),
|
|
444
|
+
contentType: response.headers.get("Content-Type") ?? "application/octet-stream",
|
|
445
|
+
headers: response.headers
|
|
446
|
+
};
|
|
447
|
+
}
|
|
428
448
|
post(path, body, options) {
|
|
429
449
|
return this.request("POST", path, body, void 0, options);
|
|
430
450
|
}
|
|
@@ -1091,6 +1111,18 @@ var SearchModule = class {
|
|
|
1091
1111
|
};
|
|
1092
1112
|
|
|
1093
1113
|
// src/modules/orders.ts
|
|
1114
|
+
function dispositionFilename(header) {
|
|
1115
|
+
if (!header) return null;
|
|
1116
|
+
const extended = /filename\*\s*=\s*(?:UTF-8|utf-8)''([^;]+)/.exec(header);
|
|
1117
|
+
if (extended?.[1]) {
|
|
1118
|
+
try {
|
|
1119
|
+
return decodeURIComponent(extended[1].trim());
|
|
1120
|
+
} catch {
|
|
1121
|
+
}
|
|
1122
|
+
}
|
|
1123
|
+
const plain = /filename\s*=\s*"?([^";]+)"?/.exec(header);
|
|
1124
|
+
return plain?.[1]?.trim() || null;
|
|
1125
|
+
}
|
|
1094
1126
|
var OrdersModule = class {
|
|
1095
1127
|
constructor(client) {
|
|
1096
1128
|
this.client = client;
|
|
@@ -1113,6 +1145,21 @@ var OrdersModule = class {
|
|
|
1113
1145
|
async transition(id, input, options) {
|
|
1114
1146
|
return this.client.post(`/orders/${id}/transition`, input, options);
|
|
1115
1147
|
}
|
|
1148
|
+
/**
|
|
1149
|
+
* Get an order's invoice or receipt as a PDF: its receipt once it is paid, its invoice while it awaits
|
|
1150
|
+
* payment. Buyer only. Every order of one checkout returns the same document.
|
|
1151
|
+
*
|
|
1152
|
+
* Errors: 404 document_not_found when the order has no document to show.
|
|
1153
|
+
*/
|
|
1154
|
+
async getDocument(id, options) {
|
|
1155
|
+
const file = await this.client.getFile(`/orders/${encodeURIComponent(id)}/document`, void 0, options);
|
|
1156
|
+
const kind = file.headers.get("X-Mitumba-Document") === "receipt" ? "receipt" : "invoice";
|
|
1157
|
+
return {
|
|
1158
|
+
kind,
|
|
1159
|
+
filename: dispositionFilename(file.headers.get("Content-Disposition")) ?? `Mitumba-${id}.pdf`,
|
|
1160
|
+
blob: file.blob
|
|
1161
|
+
};
|
|
1162
|
+
}
|
|
1116
1163
|
/**
|
|
1117
1164
|
* Get the order history for the current authenticated user.
|
|
1118
1165
|
*/
|
|
@@ -2383,6 +2430,47 @@ var AdminModule = class {
|
|
|
2383
2430
|
async listAuditLog(query2 = {}, options) {
|
|
2384
2431
|
return this.client.get("/admin/audit", query2, options);
|
|
2385
2432
|
}
|
|
2433
|
+
// ── Identity provider: sign-in clients (requires clients:manage) ──
|
|
2434
|
+
/** Every registered sign-in client, oldest first. Secrets are never included. */
|
|
2435
|
+
async listOAuthClients(options) {
|
|
2436
|
+
return this.client.get("/admin/clients", void 0, options);
|
|
2437
|
+
}
|
|
2438
|
+
/** One client with its redirect-URI allow-list and permitted scopes. */
|
|
2439
|
+
async getOAuthClient(clientId, options) {
|
|
2440
|
+
return this.client.get(`/admin/clients/${encodeURIComponent(clientId)}`, void 0, options);
|
|
2441
|
+
}
|
|
2442
|
+
/**
|
|
2443
|
+
* Register a client. A confidential client's `client_secret` is in this response only — it is
|
|
2444
|
+
* stored hashed and cannot be retrieved again, so hand it to the client's owner immediately.
|
|
2445
|
+
*/
|
|
2446
|
+
async registerOAuthClient(input, options) {
|
|
2447
|
+
return this.client.post("/admin/clients", input, options);
|
|
2448
|
+
}
|
|
2449
|
+
/** Stop a client authorising. Clients are deactivated, never deleted, so their history stays auditable. */
|
|
2450
|
+
async deactivateOAuthClient(clientId, options) {
|
|
2451
|
+
return this.client.post(`/admin/clients/${encodeURIComponent(clientId)}/deactivate`, void 0, options);
|
|
2452
|
+
}
|
|
2453
|
+
/** Replace a client's whole redirect-URI allow-list. URIs match exactly: no wildcards or prefixes. */
|
|
2454
|
+
async setOAuthClientRedirectUris(clientId, redirectUris, options) {
|
|
2455
|
+
return this.client.put(`/admin/clients/${encodeURIComponent(clientId)}/redirect-uris`, { redirect_uris: redirectUris }, options);
|
|
2456
|
+
}
|
|
2457
|
+
/** Replace the set of scopes a client may request. */
|
|
2458
|
+
async setOAuthClientScopes(clientId, scopes, options) {
|
|
2459
|
+
return this.client.put(`/admin/clients/${encodeURIComponent(clientId)}/scopes`, { scopes }, options);
|
|
2460
|
+
}
|
|
2461
|
+
// ── Identity provider: signing keys (requires oidc:rotate_keys) ──
|
|
2462
|
+
/** The signing-key window — current, previous, retired — as metadata only. */
|
|
2463
|
+
async listOidcSigningKeys(options) {
|
|
2464
|
+
return this.client.get("/auth/oidc/keys", void 0, options);
|
|
2465
|
+
}
|
|
2466
|
+
/**
|
|
2467
|
+
* Run the rotation ceremony: a new key becomes current, the current key becomes previous (still
|
|
2468
|
+
* verifying), and the old previous is retired. Do not rotate twice within an id_token lifetime
|
|
2469
|
+
* (one hour), or tokens signed by the retired key stop verifying.
|
|
2470
|
+
*/
|
|
2471
|
+
async rotateOidcSigningKey(options) {
|
|
2472
|
+
return this.client.post("/auth/oidc/keys/rotate", void 0, options);
|
|
2473
|
+
}
|
|
2386
2474
|
// ── Payout approval ──
|
|
2387
2475
|
async listPayoutsAwaitingApproval(options) {
|
|
2388
2476
|
return this.client.get("/admin/payouts/pending-approval", void 0, options);
|