@mitumba/sdk 5.3.0 → 5.4.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 +50 -1
- package/dist/index.d.ts +50 -1
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1538,6 +1538,30 @@ interface OAuthConsentRequired {
|
|
|
1538
1538
|
/** The scopes the user is being asked to grant. */
|
|
1539
1539
|
scopes: string[];
|
|
1540
1540
|
}
|
|
1541
|
+
/**
|
|
1542
|
+
* The result of a silent (`prompt=none`) authorization attempt.
|
|
1543
|
+
*
|
|
1544
|
+
* Discriminated on `ok` so a client can branch without try/catch for the expected outcomes: a
|
|
1545
|
+
* success carries the one-time `code` (+ echoed `state`) to redirect back to the relying party; a
|
|
1546
|
+
* failure carries a `reason` the client uses to decide its fallback (typically: do nothing and stay
|
|
1547
|
+
* logged out, or start a visible interactive sign-in). Only genuinely unexpected errors (network,
|
|
1548
|
+
* 5xx) throw from {@link OAuthModule.silentAuthorize}; the reasons below are returned, not thrown.
|
|
1549
|
+
*
|
|
1550
|
+
* - `login_required` — no usable session for a silent mint, or this client is not authorized for
|
|
1551
|
+
* silent authentication. The client should fall back to a visible sign-in (or stay logged out).
|
|
1552
|
+
* - `interaction_required` — consent is needed and cannot be collected silently; fall back to a
|
|
1553
|
+
* visible flow where the user can consent.
|
|
1554
|
+
* - `unauthenticated` — the request reached the gateway with no session at all (HTTP 401). Treated
|
|
1555
|
+
* as a distinct, still-non-throwing reason so "not signed in yet" is a normal silent outcome.
|
|
1556
|
+
*/
|
|
1557
|
+
type SilentAuthorizeResult = {
|
|
1558
|
+
ok: true;
|
|
1559
|
+
code: string;
|
|
1560
|
+
state: string;
|
|
1561
|
+
} | {
|
|
1562
|
+
ok: false;
|
|
1563
|
+
reason: 'login_required' | 'interaction_required' | 'unauthenticated';
|
|
1564
|
+
};
|
|
1541
1565
|
|
|
1542
1566
|
declare const CONDITIONS: readonly ["new", "like_new", "good", "fair"];
|
|
1543
1567
|
type Condition = typeof CONDITIONS[number];
|
|
@@ -2934,6 +2958,31 @@ declare class OAuthModule {
|
|
|
2934
2958
|
listConsents(options?: RequestOptions): Promise<{
|
|
2935
2959
|
consents: OAuthConsent[];
|
|
2936
2960
|
}>;
|
|
2961
|
+
/**
|
|
2962
|
+
* Attempt a silent (`prompt=none`) authorization — the "sign in once, every app knows you" path.
|
|
2963
|
+
*
|
|
2964
|
+
* Sends the authorize request with `prompt=none`, meaning: mint a code only if it can be done with
|
|
2965
|
+
* no interaction, otherwise tell me why so I can fall back. Unlike {@link OAuthModule.authorize},
|
|
2966
|
+
* the expected non-success outcomes are RETURNED (discriminated on `ok`), not thrown, so a caller
|
|
2967
|
+
* can branch cleanly without a try/catch:
|
|
2968
|
+
*
|
|
2969
|
+
* - `{ ok: true, code, state }` — redirect to `redirect_uri?code=..&state=..` as usual.
|
|
2970
|
+
* - `{ ok: false, reason: 'login_required' }` — no usable session, or this client is not
|
|
2971
|
+
* authorized for silent auth. Fall back to a visible sign-in (or stay logged out).
|
|
2972
|
+
* - `{ ok: false, reason: 'interaction_required' }` — consent needed; fall back to a visible flow.
|
|
2973
|
+
* - `{ ok: false, reason: 'unauthenticated' }` — no session reached the server (HTTP 401).
|
|
2974
|
+
*
|
|
2975
|
+
* Only genuinely unexpected errors (network failure, 5xx, an unrecognised error code) throw.
|
|
2976
|
+
* `code_challenge_method` is fixed to `'S256'` and `prompt` to `'none'` by the SDK. This is a
|
|
2977
|
+
* top-level/first-party call carrying the session the SDK holds; the server never mints for a
|
|
2978
|
+
* client that lacks the silent-auth privilege (it returns `login_required`).
|
|
2979
|
+
*
|
|
2980
|
+
* @param input - The authorize request (client, redirect URI, state, PKCE challenge, scope)
|
|
2981
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2982
|
+
* @returns A discriminated success-or-fallback result
|
|
2983
|
+
* @throws {APIError} Only on unexpected failures (network, 5xx, unknown error code)
|
|
2984
|
+
*/
|
|
2985
|
+
silentAuthorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<SilentAuthorizeResult>;
|
|
2937
2986
|
}
|
|
2938
2987
|
|
|
2939
2988
|
declare class ListingsModule {
|
|
@@ -4114,4 +4163,4 @@ declare class MitumbaClient {
|
|
|
4114
4163
|
isAuthenticated(): Promise<boolean>;
|
|
4115
4164
|
}
|
|
4116
4165
|
|
|
4117
|
-
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, 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 FollowedStore, type ForgotPasswordInput, IDBTokenStore, 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 ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, 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, 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 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 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 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 VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
4166
|
+
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, 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 FollowedStore, type ForgotPasswordInput, IDBTokenStore, 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 ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, 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, 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 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 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 VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -1538,6 +1538,30 @@ interface OAuthConsentRequired {
|
|
|
1538
1538
|
/** The scopes the user is being asked to grant. */
|
|
1539
1539
|
scopes: string[];
|
|
1540
1540
|
}
|
|
1541
|
+
/**
|
|
1542
|
+
* The result of a silent (`prompt=none`) authorization attempt.
|
|
1543
|
+
*
|
|
1544
|
+
* Discriminated on `ok` so a client can branch without try/catch for the expected outcomes: a
|
|
1545
|
+
* success carries the one-time `code` (+ echoed `state`) to redirect back to the relying party; a
|
|
1546
|
+
* failure carries a `reason` the client uses to decide its fallback (typically: do nothing and stay
|
|
1547
|
+
* logged out, or start a visible interactive sign-in). Only genuinely unexpected errors (network,
|
|
1548
|
+
* 5xx) throw from {@link OAuthModule.silentAuthorize}; the reasons below are returned, not thrown.
|
|
1549
|
+
*
|
|
1550
|
+
* - `login_required` — no usable session for a silent mint, or this client is not authorized for
|
|
1551
|
+
* silent authentication. The client should fall back to a visible sign-in (or stay logged out).
|
|
1552
|
+
* - `interaction_required` — consent is needed and cannot be collected silently; fall back to a
|
|
1553
|
+
* visible flow where the user can consent.
|
|
1554
|
+
* - `unauthenticated` — the request reached the gateway with no session at all (HTTP 401). Treated
|
|
1555
|
+
* as a distinct, still-non-throwing reason so "not signed in yet" is a normal silent outcome.
|
|
1556
|
+
*/
|
|
1557
|
+
type SilentAuthorizeResult = {
|
|
1558
|
+
ok: true;
|
|
1559
|
+
code: string;
|
|
1560
|
+
state: string;
|
|
1561
|
+
} | {
|
|
1562
|
+
ok: false;
|
|
1563
|
+
reason: 'login_required' | 'interaction_required' | 'unauthenticated';
|
|
1564
|
+
};
|
|
1541
1565
|
|
|
1542
1566
|
declare const CONDITIONS: readonly ["new", "like_new", "good", "fair"];
|
|
1543
1567
|
type Condition = typeof CONDITIONS[number];
|
|
@@ -2934,6 +2958,31 @@ declare class OAuthModule {
|
|
|
2934
2958
|
listConsents(options?: RequestOptions): Promise<{
|
|
2935
2959
|
consents: OAuthConsent[];
|
|
2936
2960
|
}>;
|
|
2961
|
+
/**
|
|
2962
|
+
* Attempt a silent (`prompt=none`) authorization — the "sign in once, every app knows you" path.
|
|
2963
|
+
*
|
|
2964
|
+
* Sends the authorize request with `prompt=none`, meaning: mint a code only if it can be done with
|
|
2965
|
+
* no interaction, otherwise tell me why so I can fall back. Unlike {@link OAuthModule.authorize},
|
|
2966
|
+
* the expected non-success outcomes are RETURNED (discriminated on `ok`), not thrown, so a caller
|
|
2967
|
+
* can branch cleanly without a try/catch:
|
|
2968
|
+
*
|
|
2969
|
+
* - `{ ok: true, code, state }` — redirect to `redirect_uri?code=..&state=..` as usual.
|
|
2970
|
+
* - `{ ok: false, reason: 'login_required' }` — no usable session, or this client is not
|
|
2971
|
+
* authorized for silent auth. Fall back to a visible sign-in (or stay logged out).
|
|
2972
|
+
* - `{ ok: false, reason: 'interaction_required' }` — consent needed; fall back to a visible flow.
|
|
2973
|
+
* - `{ ok: false, reason: 'unauthenticated' }` — no session reached the server (HTTP 401).
|
|
2974
|
+
*
|
|
2975
|
+
* Only genuinely unexpected errors (network failure, 5xx, an unrecognised error code) throw.
|
|
2976
|
+
* `code_challenge_method` is fixed to `'S256'` and `prompt` to `'none'` by the SDK. This is a
|
|
2977
|
+
* top-level/first-party call carrying the session the SDK holds; the server never mints for a
|
|
2978
|
+
* client that lacks the silent-auth privilege (it returns `login_required`).
|
|
2979
|
+
*
|
|
2980
|
+
* @param input - The authorize request (client, redirect URI, state, PKCE challenge, scope)
|
|
2981
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
2982
|
+
* @returns A discriminated success-or-fallback result
|
|
2983
|
+
* @throws {APIError} Only on unexpected failures (network, 5xx, unknown error code)
|
|
2984
|
+
*/
|
|
2985
|
+
silentAuthorize(input: OAuthAuthorizeInput, options?: RequestOptions): Promise<SilentAuthorizeResult>;
|
|
2937
2986
|
}
|
|
2938
2987
|
|
|
2939
2988
|
declare class ListingsModule {
|
|
@@ -4114,4 +4163,4 @@ declare class MitumbaClient {
|
|
|
4114
4163
|
isAuthenticated(): Promise<boolean>;
|
|
4115
4164
|
}
|
|
4116
4165
|
|
|
4117
|
-
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, 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 FollowedStore, type ForgotPasswordInput, IDBTokenStore, 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 ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, 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, 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 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 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 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 VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
4166
|
+
export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type ApiResponse, type AttachmentDownloadAuthorization, type AttachmentUploadAuthorization, type AttachmentUploadBody, type AttachmentUploadState, type AttachmentUploadStatus, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleImageUploadResult, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, type BuyerResolveThreadInput, type BuyerSummary, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type ConversationId, type ConversationSummary, type CreateAttachmentUploadInput, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateMessageBlockInput, type CreateMessageBlockResult, type CreateMessageReportInput, type CreateMessageReportResult, type CreateOrderInput, 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 FollowedStore, type ForgotPasswordInput, IDBTokenStore, 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 ListThreadMessagesParams, type ListThreadsParams, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, 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, 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 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 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 VerifyOtpInput, type WebSocketCloseEventLike, type WebSocketFactory, type WebSocketLike, type WebSocketMessageEventLike, type WholesaleAnalytics, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isConsentRequired, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.js
CHANGED
|
@@ -833,6 +833,50 @@ var OAuthModule = class {
|
|
|
833
833
|
async listConsents(options) {
|
|
834
834
|
return this.client.get("/auth/oauth/consents", void 0, options);
|
|
835
835
|
}
|
|
836
|
+
/**
|
|
837
|
+
* Attempt a silent (`prompt=none`) authorization — the "sign in once, every app knows you" path.
|
|
838
|
+
*
|
|
839
|
+
* Sends the authorize request with `prompt=none`, meaning: mint a code only if it can be done with
|
|
840
|
+
* no interaction, otherwise tell me why so I can fall back. Unlike {@link OAuthModule.authorize},
|
|
841
|
+
* the expected non-success outcomes are RETURNED (discriminated on `ok`), not thrown, so a caller
|
|
842
|
+
* can branch cleanly without a try/catch:
|
|
843
|
+
*
|
|
844
|
+
* - `{ ok: true, code, state }` — redirect to `redirect_uri?code=..&state=..` as usual.
|
|
845
|
+
* - `{ ok: false, reason: 'login_required' }` — no usable session, or this client is not
|
|
846
|
+
* authorized for silent auth. Fall back to a visible sign-in (or stay logged out).
|
|
847
|
+
* - `{ ok: false, reason: 'interaction_required' }` — consent needed; fall back to a visible flow.
|
|
848
|
+
* - `{ ok: false, reason: 'unauthenticated' }` — no session reached the server (HTTP 401).
|
|
849
|
+
*
|
|
850
|
+
* Only genuinely unexpected errors (network failure, 5xx, an unrecognised error code) throw.
|
|
851
|
+
* `code_challenge_method` is fixed to `'S256'` and `prompt` to `'none'` by the SDK. This is a
|
|
852
|
+
* top-level/first-party call carrying the session the SDK holds; the server never mints for a
|
|
853
|
+
* client that lacks the silent-auth privilege (it returns `login_required`).
|
|
854
|
+
*
|
|
855
|
+
* @param input - The authorize request (client, redirect URI, state, PKCE challenge, scope)
|
|
856
|
+
* @param options - Optional per-request options (abort signal, extra headers)
|
|
857
|
+
* @returns A discriminated success-or-fallback result
|
|
858
|
+
* @throws {APIError} Only on unexpected failures (network, 5xx, unknown error code)
|
|
859
|
+
*/
|
|
860
|
+
async silentAuthorize(input, options) {
|
|
861
|
+
try {
|
|
862
|
+
const result = await this.client.post(
|
|
863
|
+
"/auth/oauth/authorize",
|
|
864
|
+
{ ...input, code_challenge_method: "S256", prompt: "none" },
|
|
865
|
+
options
|
|
866
|
+
);
|
|
867
|
+
if (isConsentRequired(result)) return { ok: false, reason: "interaction_required" };
|
|
868
|
+
return { ok: true, code: result.code, state: result.state };
|
|
869
|
+
} catch (err) {
|
|
870
|
+
if (err instanceof APIError) {
|
|
871
|
+
if (err.status === 401) return { ok: false, reason: "unauthenticated" };
|
|
872
|
+
if (err.code === "login_required") return { ok: false, reason: "login_required" };
|
|
873
|
+
if (err.code === "interaction_required" || err.code === "consent_required") {
|
|
874
|
+
return { ok: false, reason: "interaction_required" };
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
throw err;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
836
880
|
};
|
|
837
881
|
|
|
838
882
|
// src/modules/listings.ts
|