@mitumba/sdk 5.14.0 → 5.16.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 +80 -2
- package/dist/index.d.ts +80 -2
- package/dist/index.js +67 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +67 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
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' | 'clients:manage' | 'oidc:rotate_keys' | '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' | 'library:read_all';
|
|
1022
1022
|
type AdminAuthStrength = 'password' | 'sms' | 'email' | 'totp' | 'passkey';
|
|
1023
1023
|
interface AdminRolePreset {
|
|
1024
1024
|
id: string;
|
|
@@ -1157,6 +1157,38 @@ interface OidcSigningKey {
|
|
|
1157
1157
|
created_at: string;
|
|
1158
1158
|
rotated_at: string | null;
|
|
1159
1159
|
}
|
|
1160
|
+
type LibraryKind = 'runbook' | 'routine' | 'incident' | 'reference';
|
|
1161
|
+
type LibraryCadence = 'daily' | 'weekly' | 'monthly' | 'quarterly';
|
|
1162
|
+
/** A library document as listed by `admin.listLibrary()`. Never includes the body. */
|
|
1163
|
+
interface LibraryDocumentSummary {
|
|
1164
|
+
slug: string;
|
|
1165
|
+
title: string;
|
|
1166
|
+
summary: string;
|
|
1167
|
+
kind: LibraryKind;
|
|
1168
|
+
/** The permissions that may read this document (any one of them suffices). */
|
|
1169
|
+
audience: AdminPermission[];
|
|
1170
|
+
owner: string;
|
|
1171
|
+
/** How often a routine is carried out; null when the document is not a routine. */
|
|
1172
|
+
cadence: LibraryCadence | null;
|
|
1173
|
+
/** How often the document itself must be re-checked. */
|
|
1174
|
+
reviewEveryDays: number;
|
|
1175
|
+
/** YYYY-MM-DD. */
|
|
1176
|
+
lastReviewed: string;
|
|
1177
|
+
/** YYYY-MM-DD: `lastReviewed` plus `reviewEveryDays`. */
|
|
1178
|
+
reviewDueOn: string;
|
|
1179
|
+
/** True once `reviewDueOn` has passed. */
|
|
1180
|
+
reviewOverdue: boolean;
|
|
1181
|
+
}
|
|
1182
|
+
/** One library document with its markdown body, from `admin.getLibraryDocument()`. */
|
|
1183
|
+
interface LibraryDocument extends LibraryDocumentSummary {
|
|
1184
|
+
markdown: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface LibraryListing {
|
|
1187
|
+
/** Only the documents the caller may read. */
|
|
1188
|
+
documents: LibraryDocumentSummary[];
|
|
1189
|
+
/** True when the caller holds `library:read_all` and so sees every document. */
|
|
1190
|
+
can_read_all: boolean;
|
|
1191
|
+
}
|
|
1160
1192
|
|
|
1161
1193
|
interface AuthTokens {
|
|
1162
1194
|
access_token: string;
|
|
@@ -1859,6 +1891,16 @@ interface OrderHistoryParams {
|
|
|
1859
1891
|
store_id?: string;
|
|
1860
1892
|
page?: number;
|
|
1861
1893
|
}
|
|
1894
|
+
/** Which document an order has: its invoice while it awaits payment, its receipt once it is paid. */
|
|
1895
|
+
type OrderDocumentKind = 'invoice' | 'receipt';
|
|
1896
|
+
/** An order's invoice or receipt, as a PDF. Every order of one checkout has the same document. */
|
|
1897
|
+
interface OrderDocument {
|
|
1898
|
+
kind: OrderDocumentKind;
|
|
1899
|
+
/** The name to save it under, e.g. Mitumba-Receipt-RCT-20261110-C0FFEE00.pdf. */
|
|
1900
|
+
filename: string;
|
|
1901
|
+
/** The PDF (application/pdf). */
|
|
1902
|
+
blob: Blob;
|
|
1903
|
+
}
|
|
1862
1904
|
|
|
1863
1905
|
type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
|
|
1864
1906
|
type BaleType = 'original' | 'sorted';
|
|
@@ -2940,6 +2982,14 @@ interface PaginatedResponse<T> {
|
|
|
2940
2982
|
has_more: boolean;
|
|
2941
2983
|
}
|
|
2942
2984
|
|
|
2985
|
+
/** A successful response whose body is a file rather than JSON. */
|
|
2986
|
+
interface FileResponse {
|
|
2987
|
+
blob: Blob;
|
|
2988
|
+
/** The response's Content-Type, or application/octet-stream when it gave none. */
|
|
2989
|
+
contentType: string;
|
|
2990
|
+
/** Every response header, for metadata such as Content-Disposition. */
|
|
2991
|
+
headers: Headers;
|
|
2992
|
+
}
|
|
2943
2993
|
interface RequestOptions {
|
|
2944
2994
|
signal?: AbortSignal;
|
|
2945
2995
|
/**
|
|
@@ -2992,8 +3042,18 @@ declare class APIClient {
|
|
|
2992
3042
|
hydrate(): Promise<void>;
|
|
2993
3043
|
ensureFreshToken(options?: RequestOptions): Promise<void>;
|
|
2994
3044
|
private request;
|
|
3045
|
+
/**
|
|
3046
|
+
* One request with authentication, proactive and reactive token refresh, retries and error decoding.
|
|
3047
|
+
* Resolves with the successful response, unread, so the caller chooses how to read its body.
|
|
3048
|
+
*/
|
|
3049
|
+
private send;
|
|
2995
3050
|
private handleTokenRefresh;
|
|
2996
3051
|
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<T>;
|
|
3052
|
+
/**
|
|
3053
|
+
* A GET whose response is a file (a PDF, an image) rather than JSON. Authentication, refresh,
|
|
3054
|
+
* retries and errors are exactly those of {@link get}; an error response still decodes its JSON body.
|
|
3055
|
+
*/
|
|
3056
|
+
getFile(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<FileResponse>;
|
|
2997
3057
|
post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2998
3058
|
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2999
3059
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
@@ -3535,6 +3595,13 @@ declare class OrdersModule {
|
|
|
3535
3595
|
ok: boolean;
|
|
3536
3596
|
status: OrderStatus;
|
|
3537
3597
|
}>;
|
|
3598
|
+
/**
|
|
3599
|
+
* Get an order's invoice or receipt as a PDF: its receipt once it is paid, its invoice while it awaits
|
|
3600
|
+
* payment. Buyer only. Every order of one checkout returns the same document.
|
|
3601
|
+
*
|
|
3602
|
+
* Errors: 404 document_not_found when the order has no document to show.
|
|
3603
|
+
*/
|
|
3604
|
+
getDocument(id: string, options?: RequestOptions): Promise<OrderDocument>;
|
|
3538
3605
|
/**
|
|
3539
3606
|
* Get the order history for the current authenticated user.
|
|
3540
3607
|
*/
|
|
@@ -4294,6 +4361,17 @@ declare class AdminModule {
|
|
|
4294
4361
|
ok: true;
|
|
4295
4362
|
kid: string;
|
|
4296
4363
|
}>;
|
|
4364
|
+
/**
|
|
4365
|
+
* The library documents the caller may read: summaries only, never bodies. Any operator may call
|
|
4366
|
+
* this; each document's `audience` decides whether it is listed. `can_read_all` is true for a
|
|
4367
|
+
* caller holding `library:read_all`, who sees every document.
|
|
4368
|
+
*/
|
|
4369
|
+
listLibrary(options?: RequestOptions): Promise<LibraryListing>;
|
|
4370
|
+
/**
|
|
4371
|
+
* One library document with its markdown body. A document the caller may not read is reported
|
|
4372
|
+
* exactly like one that does not exist (404).
|
|
4373
|
+
*/
|
|
4374
|
+
getLibraryDocument(slug: string, options?: RequestOptions): Promise<LibraryDocument>;
|
|
4297
4375
|
listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
|
|
4298
4376
|
payouts: PendingPayoutApproval[];
|
|
4299
4377
|
}>;
|
|
@@ -4772,4 +4850,4 @@ declare class MitumbaClient {
|
|
|
4772
4850
|
isAuthenticated(): Promise<boolean>;
|
|
4773
4851
|
}
|
|
4774
4852
|
|
|
4775
|
-
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 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 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 };
|
|
4853
|
+
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 LibraryCadence, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, 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' | 'clients:manage' | 'oidc:rotate_keys' | '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' | 'library:read_all';
|
|
1022
1022
|
type AdminAuthStrength = 'password' | 'sms' | 'email' | 'totp' | 'passkey';
|
|
1023
1023
|
interface AdminRolePreset {
|
|
1024
1024
|
id: string;
|
|
@@ -1157,6 +1157,38 @@ interface OidcSigningKey {
|
|
|
1157
1157
|
created_at: string;
|
|
1158
1158
|
rotated_at: string | null;
|
|
1159
1159
|
}
|
|
1160
|
+
type LibraryKind = 'runbook' | 'routine' | 'incident' | 'reference';
|
|
1161
|
+
type LibraryCadence = 'daily' | 'weekly' | 'monthly' | 'quarterly';
|
|
1162
|
+
/** A library document as listed by `admin.listLibrary()`. Never includes the body. */
|
|
1163
|
+
interface LibraryDocumentSummary {
|
|
1164
|
+
slug: string;
|
|
1165
|
+
title: string;
|
|
1166
|
+
summary: string;
|
|
1167
|
+
kind: LibraryKind;
|
|
1168
|
+
/** The permissions that may read this document (any one of them suffices). */
|
|
1169
|
+
audience: AdminPermission[];
|
|
1170
|
+
owner: string;
|
|
1171
|
+
/** How often a routine is carried out; null when the document is not a routine. */
|
|
1172
|
+
cadence: LibraryCadence | null;
|
|
1173
|
+
/** How often the document itself must be re-checked. */
|
|
1174
|
+
reviewEveryDays: number;
|
|
1175
|
+
/** YYYY-MM-DD. */
|
|
1176
|
+
lastReviewed: string;
|
|
1177
|
+
/** YYYY-MM-DD: `lastReviewed` plus `reviewEveryDays`. */
|
|
1178
|
+
reviewDueOn: string;
|
|
1179
|
+
/** True once `reviewDueOn` has passed. */
|
|
1180
|
+
reviewOverdue: boolean;
|
|
1181
|
+
}
|
|
1182
|
+
/** One library document with its markdown body, from `admin.getLibraryDocument()`. */
|
|
1183
|
+
interface LibraryDocument extends LibraryDocumentSummary {
|
|
1184
|
+
markdown: string;
|
|
1185
|
+
}
|
|
1186
|
+
interface LibraryListing {
|
|
1187
|
+
/** Only the documents the caller may read. */
|
|
1188
|
+
documents: LibraryDocumentSummary[];
|
|
1189
|
+
/** True when the caller holds `library:read_all` and so sees every document. */
|
|
1190
|
+
can_read_all: boolean;
|
|
1191
|
+
}
|
|
1160
1192
|
|
|
1161
1193
|
interface AuthTokens {
|
|
1162
1194
|
access_token: string;
|
|
@@ -1859,6 +1891,16 @@ interface OrderHistoryParams {
|
|
|
1859
1891
|
store_id?: string;
|
|
1860
1892
|
page?: number;
|
|
1861
1893
|
}
|
|
1894
|
+
/** Which document an order has: its invoice while it awaits payment, its receipt once it is paid. */
|
|
1895
|
+
type OrderDocumentKind = 'invoice' | 'receipt';
|
|
1896
|
+
/** An order's invoice or receipt, as a PDF. Every order of one checkout has the same document. */
|
|
1897
|
+
interface OrderDocument {
|
|
1898
|
+
kind: OrderDocumentKind;
|
|
1899
|
+
/** The name to save it under, e.g. Mitumba-Receipt-RCT-20261110-C0FFEE00.pdf. */
|
|
1900
|
+
filename: string;
|
|
1901
|
+
/** The PDF (application/pdf). */
|
|
1902
|
+
blob: Blob;
|
|
1903
|
+
}
|
|
1862
1904
|
|
|
1863
1905
|
type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
|
|
1864
1906
|
type BaleType = 'original' | 'sorted';
|
|
@@ -2940,6 +2982,14 @@ interface PaginatedResponse<T> {
|
|
|
2940
2982
|
has_more: boolean;
|
|
2941
2983
|
}
|
|
2942
2984
|
|
|
2985
|
+
/** A successful response whose body is a file rather than JSON. */
|
|
2986
|
+
interface FileResponse {
|
|
2987
|
+
blob: Blob;
|
|
2988
|
+
/** The response's Content-Type, or application/octet-stream when it gave none. */
|
|
2989
|
+
contentType: string;
|
|
2990
|
+
/** Every response header, for metadata such as Content-Disposition. */
|
|
2991
|
+
headers: Headers;
|
|
2992
|
+
}
|
|
2943
2993
|
interface RequestOptions {
|
|
2944
2994
|
signal?: AbortSignal;
|
|
2945
2995
|
/**
|
|
@@ -2992,8 +3042,18 @@ declare class APIClient {
|
|
|
2992
3042
|
hydrate(): Promise<void>;
|
|
2993
3043
|
ensureFreshToken(options?: RequestOptions): Promise<void>;
|
|
2994
3044
|
private request;
|
|
3045
|
+
/**
|
|
3046
|
+
* One request with authentication, proactive and reactive token refresh, retries and error decoding.
|
|
3047
|
+
* Resolves with the successful response, unread, so the caller chooses how to read its body.
|
|
3048
|
+
*/
|
|
3049
|
+
private send;
|
|
2995
3050
|
private handleTokenRefresh;
|
|
2996
3051
|
get<T>(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<T>;
|
|
3052
|
+
/**
|
|
3053
|
+
* A GET whose response is a file (a PDF, an image) rather than JSON. Authentication, refresh,
|
|
3054
|
+
* retries and errors are exactly those of {@link get}; an error response still decodes its JSON body.
|
|
3055
|
+
*/
|
|
3056
|
+
getFile(path: string, params?: Record<string, string | number | boolean | undefined>, options?: RequestOptions): Promise<FileResponse>;
|
|
2997
3057
|
post<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2998
3058
|
put<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
2999
3059
|
patch<T>(path: string, body?: unknown, options?: RequestOptions): Promise<T>;
|
|
@@ -3535,6 +3595,13 @@ declare class OrdersModule {
|
|
|
3535
3595
|
ok: boolean;
|
|
3536
3596
|
status: OrderStatus;
|
|
3537
3597
|
}>;
|
|
3598
|
+
/**
|
|
3599
|
+
* Get an order's invoice or receipt as a PDF: its receipt once it is paid, its invoice while it awaits
|
|
3600
|
+
* payment. Buyer only. Every order of one checkout returns the same document.
|
|
3601
|
+
*
|
|
3602
|
+
* Errors: 404 document_not_found when the order has no document to show.
|
|
3603
|
+
*/
|
|
3604
|
+
getDocument(id: string, options?: RequestOptions): Promise<OrderDocument>;
|
|
3538
3605
|
/**
|
|
3539
3606
|
* Get the order history for the current authenticated user.
|
|
3540
3607
|
*/
|
|
@@ -4294,6 +4361,17 @@ declare class AdminModule {
|
|
|
4294
4361
|
ok: true;
|
|
4295
4362
|
kid: string;
|
|
4296
4363
|
}>;
|
|
4364
|
+
/**
|
|
4365
|
+
* The library documents the caller may read: summaries only, never bodies. Any operator may call
|
|
4366
|
+
* this; each document's `audience` decides whether it is listed. `can_read_all` is true for a
|
|
4367
|
+
* caller holding `library:read_all`, who sees every document.
|
|
4368
|
+
*/
|
|
4369
|
+
listLibrary(options?: RequestOptions): Promise<LibraryListing>;
|
|
4370
|
+
/**
|
|
4371
|
+
* One library document with its markdown body. A document the caller may not read is reported
|
|
4372
|
+
* exactly like one that does not exist (404).
|
|
4373
|
+
*/
|
|
4374
|
+
getLibraryDocument(slug: string, options?: RequestOptions): Promise<LibraryDocument>;
|
|
4297
4375
|
listPayoutsAwaitingApproval(options?: RequestOptions): Promise<{
|
|
4298
4376
|
payouts: PendingPayoutApproval[];
|
|
4299
4377
|
}>;
|
|
@@ -4772,4 +4850,4 @@ declare class MitumbaClient {
|
|
|
4772
4850
|
isAuthenticated(): Promise<boolean>;
|
|
4773
4851
|
}
|
|
4774
4852
|
|
|
4775
|
-
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 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 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 };
|
|
4853
|
+
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 LibraryCadence, type LibraryDocument, type LibraryDocumentSummary, type LibraryKind, type LibraryListing, 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
|
*/
|
|
@@ -2424,6 +2471,22 @@ var AdminModule = class {
|
|
|
2424
2471
|
async rotateOidcSigningKey(options) {
|
|
2425
2472
|
return this.client.post("/auth/oidc/keys/rotate", void 0, options);
|
|
2426
2473
|
}
|
|
2474
|
+
// ── Operations library ──
|
|
2475
|
+
/**
|
|
2476
|
+
* The library documents the caller may read: summaries only, never bodies. Any operator may call
|
|
2477
|
+
* this; each document's `audience` decides whether it is listed. `can_read_all` is true for a
|
|
2478
|
+
* caller holding `library:read_all`, who sees every document.
|
|
2479
|
+
*/
|
|
2480
|
+
async listLibrary(options) {
|
|
2481
|
+
return this.client.get("/admin/library", void 0, options);
|
|
2482
|
+
}
|
|
2483
|
+
/**
|
|
2484
|
+
* One library document with its markdown body. A document the caller may not read is reported
|
|
2485
|
+
* exactly like one that does not exist (404).
|
|
2486
|
+
*/
|
|
2487
|
+
async getLibraryDocument(slug, options) {
|
|
2488
|
+
return this.client.get(`/admin/library/${encodeURIComponent(slug)}`, void 0, options);
|
|
2489
|
+
}
|
|
2427
2490
|
// ── Payout approval ──
|
|
2428
2491
|
async listPayoutsAwaitingApproval(options) {
|
|
2429
2492
|
return this.client.get("/admin/payouts/pending-approval", void 0, options);
|