@mitumba/sdk 1.32.1 → 2.0.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 +104 -32
- package/dist/index.d.ts +104 -32
- package/dist/index.js +61 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +61 -53
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -818,6 +818,28 @@ interface LegacyMessagePage {
|
|
|
818
818
|
/** Whether older history remains. */
|
|
819
819
|
has_older: boolean;
|
|
820
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store by `store_id`;
|
|
823
|
+
* a store blocks a buyer by `buyer_id`.
|
|
824
|
+
*/
|
|
825
|
+
type MessagingBlockInput = {
|
|
826
|
+
store_id: string;
|
|
827
|
+
reason?: string;
|
|
828
|
+
} | {
|
|
829
|
+
buyer_id: string;
|
|
830
|
+
reason?: string;
|
|
831
|
+
};
|
|
832
|
+
/** Idempotent block result. */
|
|
833
|
+
interface MessagingBlockResult {
|
|
834
|
+
id: string;
|
|
835
|
+
active: boolean;
|
|
836
|
+
deduplicated: boolean;
|
|
837
|
+
}
|
|
838
|
+
/** Result of removing a block. */
|
|
839
|
+
interface MessagingBlockRemovedResult {
|
|
840
|
+
ok: true;
|
|
841
|
+
active: false;
|
|
842
|
+
}
|
|
821
843
|
|
|
822
844
|
interface BlockedIp {
|
|
823
845
|
ip: string;
|
|
@@ -1642,6 +1664,43 @@ interface CreateBaleOrderInput {
|
|
|
1642
1664
|
qty?: number;
|
|
1643
1665
|
fulfillment: BaleFulfillment;
|
|
1644
1666
|
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Result of uploading a bale image directly via multipart/form-data. Mirrors the listing image
|
|
1669
|
+
* upload result; the presign step reuses `PresignImageResponse` from the listings types.
|
|
1670
|
+
*/
|
|
1671
|
+
interface BaleImageUploadResult {
|
|
1672
|
+
r2_key: string;
|
|
1673
|
+
image_id: string;
|
|
1674
|
+
url: string;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Performance analytics for a wholesale store. Mirrors the retail `StoreAnalytics` shape where it
|
|
1678
|
+
* applies (revenue series, order breakdown) and adapts the rest to bales (top bales, bale totals).
|
|
1679
|
+
*/
|
|
1680
|
+
interface WholesaleAnalytics {
|
|
1681
|
+
revenue: {
|
|
1682
|
+
date: string;
|
|
1683
|
+
revenue: number;
|
|
1684
|
+
orders: number;
|
|
1685
|
+
}[];
|
|
1686
|
+
orders_breakdown: {
|
|
1687
|
+
date: string;
|
|
1688
|
+
completed: number;
|
|
1689
|
+
pending: number;
|
|
1690
|
+
cancelled: number;
|
|
1691
|
+
}[];
|
|
1692
|
+
top_bales: {
|
|
1693
|
+
bale_id: string;
|
|
1694
|
+
title: string;
|
|
1695
|
+
orders: number;
|
|
1696
|
+
revenue: number;
|
|
1697
|
+
}[];
|
|
1698
|
+
totals: {
|
|
1699
|
+
bales: number;
|
|
1700
|
+
orders: number;
|
|
1701
|
+
revenue: number;
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1645
1704
|
|
|
1646
1705
|
interface StkPushInput {
|
|
1647
1706
|
order_id: string;
|
|
@@ -2745,37 +2804,15 @@ declare class VaziModule {
|
|
|
2745
2804
|
declare class MessagesModule {
|
|
2746
2805
|
private readonly client;
|
|
2747
2806
|
constructor(client: APIClient);
|
|
2748
|
-
/**
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
send(input: SendMessageInput, options?: RequestOptions): Promise<{
|
|
2758
|
-
id: string;
|
|
2759
|
-
}>;
|
|
2760
|
-
/** @deprecated Use advanceThreadReadCursor for precise monotonic state. */
|
|
2761
|
-
markRead(partnerId: string, storeId?: string, options?: RequestOptions): Promise<{
|
|
2762
|
-
ok: true;
|
|
2763
|
-
}>;
|
|
2764
|
-
/** @deprecated Use managed messaging realtime. */
|
|
2765
|
-
connectTyping(partnerId: string): WebSocket;
|
|
2766
|
-
/** @deprecated Use managed messaging realtime. */
|
|
2767
|
-
connectInbox(): WebSocket;
|
|
2768
|
-
/** Create a legacy inbox socket only after hydrating/refreshing the access token. */
|
|
2769
|
-
connectInboxFresh(options?: RequestOptions): Promise<WebSocketLike>;
|
|
2770
|
-
/** Create a report for a message or conversation. */
|
|
2771
|
-
createReport(input: CreateMessageReportInput, options?: RequestOptions): Promise<CreateMessageReportResult>;
|
|
2772
|
-
/** Create an idempotent bilateral buyer/store relationship block. */
|
|
2773
|
-
createBlock(input: CreateMessageBlockInput, options?: RequestOptions): Promise<CreateMessageBlockResult>;
|
|
2774
|
-
/** Remove a block created by the current perspective. */
|
|
2775
|
-
removeBlock(blockId: string, options?: RequestOptions): Promise<{
|
|
2776
|
-
ok: true;
|
|
2777
|
-
active: false;
|
|
2778
|
-
}>;
|
|
2807
|
+
/**
|
|
2808
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
|
|
2809
|
+
* a store blocks a buyer (`{ buyer_id }`). Idempotent.
|
|
2810
|
+
*/
|
|
2811
|
+
createMessagingBlock(perspective: MessagingPerspective, input: MessagingBlockInput, options?: RequestOptions): Promise<MessagingBlockResult>;
|
|
2812
|
+
/** Remove a block the current perspective created. */
|
|
2813
|
+
removeMessagingBlock(perspective: MessagingPerspective, blockId: string, options?: RequestOptions): Promise<MessagingBlockRemovedResult>;
|
|
2814
|
+
/** File a message or conversation report from a v2 inbox perspective. Idempotent on open reports. */
|
|
2815
|
+
createMessagingReport(perspective: MessagingPerspective, input: CreateMessageReportInput, options?: RequestOptions): Promise<CreateMessageReportResult>;
|
|
2779
2816
|
/** Discover server messaging capabilities. */
|
|
2780
2817
|
getMessagingCapabilities(options?: RequestOptions): Promise<MessagingCapabilities>;
|
|
2781
2818
|
/** List buyer and represented-store inbox perspectives. */
|
|
@@ -3541,6 +3578,25 @@ declare class WholesaleModule {
|
|
|
3541
3578
|
myBales(options?: RequestOptions): Promise<{
|
|
3542
3579
|
data: Bale[];
|
|
3543
3580
|
}>;
|
|
3581
|
+
/**
|
|
3582
|
+
* Presign a bale image upload slot (requires the owning wholesale store).
|
|
3583
|
+
*
|
|
3584
|
+
* @param baleId - The bale to attach the image to
|
|
3585
|
+
* @param index - The slot index; slot 0 is the cover
|
|
3586
|
+
* @returns The storage key and image id for the slot
|
|
3587
|
+
* @throws {APIError} On network or server errors
|
|
3588
|
+
*/
|
|
3589
|
+
presignBaleImage(baleId: string, index: number, options?: RequestOptions): Promise<PresignImageResponse>;
|
|
3590
|
+
/**
|
|
3591
|
+
* Upload a bale image file directly. Uses multipart/form-data. Slot 0 is the cover.
|
|
3592
|
+
*
|
|
3593
|
+
* @param baleId - The bale to attach the image to
|
|
3594
|
+
* @param file - The image file as a `Blob` (React Native passes a `{ uri, name, type }` part)
|
|
3595
|
+
* @param index - The slot index; slot 0 is the cover
|
|
3596
|
+
* @returns The storage key, image id, and public URL
|
|
3597
|
+
* @throws {APIError} On network or server errors
|
|
3598
|
+
*/
|
|
3599
|
+
uploadBaleImage(baleId: string, file: Blob, index: number, options?: RequestOptions): Promise<BaleImageUploadResult>;
|
|
3544
3600
|
/** Browse the wholesale bale feed (public). */
|
|
3545
3601
|
wholesaleFeed(params?: WholesaleFeedParams, options?: RequestOptions): Promise<{
|
|
3546
3602
|
data: BaleFeedItem[];
|
|
@@ -3569,6 +3625,22 @@ declare class WholesaleModule {
|
|
|
3569
3625
|
ok: true;
|
|
3570
3626
|
status: BaleOrderStatus;
|
|
3571
3627
|
}>;
|
|
3628
|
+
/**
|
|
3629
|
+
* Get performance analytics for the current user's wholesale store (bale_seller only).
|
|
3630
|
+
*
|
|
3631
|
+
* The wholesale store is resolved server-side from the session, so no store id is passed — the
|
|
3632
|
+
* same way `getWholesaleStore`, `myBales`, and `incomingBaleOrders` work.
|
|
3633
|
+
*
|
|
3634
|
+
* @param period - Optional granularity; defaults to the server's default window
|
|
3635
|
+
* @returns Revenue series, order breakdown, top bales, and totals
|
|
3636
|
+
* @throws {APIError} On network or server errors
|
|
3637
|
+
*
|
|
3638
|
+
* @example
|
|
3639
|
+
* ```typescript
|
|
3640
|
+
* const analytics = await sdk.wholesale.getAnalytics('weekly')
|
|
3641
|
+
* ```
|
|
3642
|
+
*/
|
|
3643
|
+
getAnalytics(period?: 'daily' | 'weekly' | 'monthly', options?: RequestOptions): Promise<WholesaleAnalytics>;
|
|
3572
3644
|
}
|
|
3573
3645
|
|
|
3574
3646
|
/**
|
|
@@ -3646,4 +3718,4 @@ declare class MitumbaClient {
|
|
|
3646
3718
|
isAuthenticated(): Promise<boolean>;
|
|
3647
3719
|
}
|
|
3648
3720
|
|
|
3649
|
-
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 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 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 MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, 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 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 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 WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
3721
|
+
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 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, ORDER_STATUSES, 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 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 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, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.d.ts
CHANGED
|
@@ -818,6 +818,28 @@ interface LegacyMessagePage {
|
|
|
818
818
|
/** Whether older history remains. */
|
|
819
819
|
has_older: boolean;
|
|
820
820
|
}
|
|
821
|
+
/**
|
|
822
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store by `store_id`;
|
|
823
|
+
* a store blocks a buyer by `buyer_id`.
|
|
824
|
+
*/
|
|
825
|
+
type MessagingBlockInput = {
|
|
826
|
+
store_id: string;
|
|
827
|
+
reason?: string;
|
|
828
|
+
} | {
|
|
829
|
+
buyer_id: string;
|
|
830
|
+
reason?: string;
|
|
831
|
+
};
|
|
832
|
+
/** Idempotent block result. */
|
|
833
|
+
interface MessagingBlockResult {
|
|
834
|
+
id: string;
|
|
835
|
+
active: boolean;
|
|
836
|
+
deduplicated: boolean;
|
|
837
|
+
}
|
|
838
|
+
/** Result of removing a block. */
|
|
839
|
+
interface MessagingBlockRemovedResult {
|
|
840
|
+
ok: true;
|
|
841
|
+
active: false;
|
|
842
|
+
}
|
|
821
843
|
|
|
822
844
|
interface BlockedIp {
|
|
823
845
|
ip: string;
|
|
@@ -1642,6 +1664,43 @@ interface CreateBaleOrderInput {
|
|
|
1642
1664
|
qty?: number;
|
|
1643
1665
|
fulfillment: BaleFulfillment;
|
|
1644
1666
|
}
|
|
1667
|
+
/**
|
|
1668
|
+
* Result of uploading a bale image directly via multipart/form-data. Mirrors the listing image
|
|
1669
|
+
* upload result; the presign step reuses `PresignImageResponse` from the listings types.
|
|
1670
|
+
*/
|
|
1671
|
+
interface BaleImageUploadResult {
|
|
1672
|
+
r2_key: string;
|
|
1673
|
+
image_id: string;
|
|
1674
|
+
url: string;
|
|
1675
|
+
}
|
|
1676
|
+
/**
|
|
1677
|
+
* Performance analytics for a wholesale store. Mirrors the retail `StoreAnalytics` shape where it
|
|
1678
|
+
* applies (revenue series, order breakdown) and adapts the rest to bales (top bales, bale totals).
|
|
1679
|
+
*/
|
|
1680
|
+
interface WholesaleAnalytics {
|
|
1681
|
+
revenue: {
|
|
1682
|
+
date: string;
|
|
1683
|
+
revenue: number;
|
|
1684
|
+
orders: number;
|
|
1685
|
+
}[];
|
|
1686
|
+
orders_breakdown: {
|
|
1687
|
+
date: string;
|
|
1688
|
+
completed: number;
|
|
1689
|
+
pending: number;
|
|
1690
|
+
cancelled: number;
|
|
1691
|
+
}[];
|
|
1692
|
+
top_bales: {
|
|
1693
|
+
bale_id: string;
|
|
1694
|
+
title: string;
|
|
1695
|
+
orders: number;
|
|
1696
|
+
revenue: number;
|
|
1697
|
+
}[];
|
|
1698
|
+
totals: {
|
|
1699
|
+
bales: number;
|
|
1700
|
+
orders: number;
|
|
1701
|
+
revenue: number;
|
|
1702
|
+
};
|
|
1703
|
+
}
|
|
1645
1704
|
|
|
1646
1705
|
interface StkPushInput {
|
|
1647
1706
|
order_id: string;
|
|
@@ -2745,37 +2804,15 @@ declare class VaziModule {
|
|
|
2745
2804
|
declare class MessagesModule {
|
|
2746
2805
|
private readonly client;
|
|
2747
2806
|
constructor(client: APIClient);
|
|
2748
|
-
/**
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
send(input: SendMessageInput, options?: RequestOptions): Promise<{
|
|
2758
|
-
id: string;
|
|
2759
|
-
}>;
|
|
2760
|
-
/** @deprecated Use advanceThreadReadCursor for precise monotonic state. */
|
|
2761
|
-
markRead(partnerId: string, storeId?: string, options?: RequestOptions): Promise<{
|
|
2762
|
-
ok: true;
|
|
2763
|
-
}>;
|
|
2764
|
-
/** @deprecated Use managed messaging realtime. */
|
|
2765
|
-
connectTyping(partnerId: string): WebSocket;
|
|
2766
|
-
/** @deprecated Use managed messaging realtime. */
|
|
2767
|
-
connectInbox(): WebSocket;
|
|
2768
|
-
/** Create a legacy inbox socket only after hydrating/refreshing the access token. */
|
|
2769
|
-
connectInboxFresh(options?: RequestOptions): Promise<WebSocketLike>;
|
|
2770
|
-
/** Create a report for a message or conversation. */
|
|
2771
|
-
createReport(input: CreateMessageReportInput, options?: RequestOptions): Promise<CreateMessageReportResult>;
|
|
2772
|
-
/** Create an idempotent bilateral buyer/store relationship block. */
|
|
2773
|
-
createBlock(input: CreateMessageBlockInput, options?: RequestOptions): Promise<CreateMessageBlockResult>;
|
|
2774
|
-
/** Remove a block created by the current perspective. */
|
|
2775
|
-
removeBlock(blockId: string, options?: RequestOptions): Promise<{
|
|
2776
|
-
ok: true;
|
|
2777
|
-
active: false;
|
|
2778
|
-
}>;
|
|
2807
|
+
/**
|
|
2808
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
|
|
2809
|
+
* a store blocks a buyer (`{ buyer_id }`). Idempotent.
|
|
2810
|
+
*/
|
|
2811
|
+
createMessagingBlock(perspective: MessagingPerspective, input: MessagingBlockInput, options?: RequestOptions): Promise<MessagingBlockResult>;
|
|
2812
|
+
/** Remove a block the current perspective created. */
|
|
2813
|
+
removeMessagingBlock(perspective: MessagingPerspective, blockId: string, options?: RequestOptions): Promise<MessagingBlockRemovedResult>;
|
|
2814
|
+
/** File a message or conversation report from a v2 inbox perspective. Idempotent on open reports. */
|
|
2815
|
+
createMessagingReport(perspective: MessagingPerspective, input: CreateMessageReportInput, options?: RequestOptions): Promise<CreateMessageReportResult>;
|
|
2779
2816
|
/** Discover server messaging capabilities. */
|
|
2780
2817
|
getMessagingCapabilities(options?: RequestOptions): Promise<MessagingCapabilities>;
|
|
2781
2818
|
/** List buyer and represented-store inbox perspectives. */
|
|
@@ -3541,6 +3578,25 @@ declare class WholesaleModule {
|
|
|
3541
3578
|
myBales(options?: RequestOptions): Promise<{
|
|
3542
3579
|
data: Bale[];
|
|
3543
3580
|
}>;
|
|
3581
|
+
/**
|
|
3582
|
+
* Presign a bale image upload slot (requires the owning wholesale store).
|
|
3583
|
+
*
|
|
3584
|
+
* @param baleId - The bale to attach the image to
|
|
3585
|
+
* @param index - The slot index; slot 0 is the cover
|
|
3586
|
+
* @returns The storage key and image id for the slot
|
|
3587
|
+
* @throws {APIError} On network or server errors
|
|
3588
|
+
*/
|
|
3589
|
+
presignBaleImage(baleId: string, index: number, options?: RequestOptions): Promise<PresignImageResponse>;
|
|
3590
|
+
/**
|
|
3591
|
+
* Upload a bale image file directly. Uses multipart/form-data. Slot 0 is the cover.
|
|
3592
|
+
*
|
|
3593
|
+
* @param baleId - The bale to attach the image to
|
|
3594
|
+
* @param file - The image file as a `Blob` (React Native passes a `{ uri, name, type }` part)
|
|
3595
|
+
* @param index - The slot index; slot 0 is the cover
|
|
3596
|
+
* @returns The storage key, image id, and public URL
|
|
3597
|
+
* @throws {APIError} On network or server errors
|
|
3598
|
+
*/
|
|
3599
|
+
uploadBaleImage(baleId: string, file: Blob, index: number, options?: RequestOptions): Promise<BaleImageUploadResult>;
|
|
3544
3600
|
/** Browse the wholesale bale feed (public). */
|
|
3545
3601
|
wholesaleFeed(params?: WholesaleFeedParams, options?: RequestOptions): Promise<{
|
|
3546
3602
|
data: BaleFeedItem[];
|
|
@@ -3569,6 +3625,22 @@ declare class WholesaleModule {
|
|
|
3569
3625
|
ok: true;
|
|
3570
3626
|
status: BaleOrderStatus;
|
|
3571
3627
|
}>;
|
|
3628
|
+
/**
|
|
3629
|
+
* Get performance analytics for the current user's wholesale store (bale_seller only).
|
|
3630
|
+
*
|
|
3631
|
+
* The wholesale store is resolved server-side from the session, so no store id is passed — the
|
|
3632
|
+
* same way `getWholesaleStore`, `myBales`, and `incomingBaleOrders` work.
|
|
3633
|
+
*
|
|
3634
|
+
* @param period - Optional granularity; defaults to the server's default window
|
|
3635
|
+
* @returns Revenue series, order breakdown, top bales, and totals
|
|
3636
|
+
* @throws {APIError} On network or server errors
|
|
3637
|
+
*
|
|
3638
|
+
* @example
|
|
3639
|
+
* ```typescript
|
|
3640
|
+
* const analytics = await sdk.wholesale.getAnalytics('weekly')
|
|
3641
|
+
* ```
|
|
3642
|
+
*/
|
|
3643
|
+
getAnalytics(period?: 'daily' | 'weekly' | 'monthly', options?: RequestOptions): Promise<WholesaleAnalytics>;
|
|
3572
3644
|
}
|
|
3573
3645
|
|
|
3574
3646
|
/**
|
|
@@ -3646,4 +3718,4 @@ declare class MitumbaClient {
|
|
|
3646
3718
|
isAuthenticated(): Promise<boolean>;
|
|
3647
3719
|
}
|
|
3648
3720
|
|
|
3649
|
-
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 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 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 MessagingCapabilities, type MessagingCursor, type MessagingErrorCode, type MessagingIdempotentRequestOptions, type MessagingInboxes, type MessagingPerspective, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, 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 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 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 WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
|
3721
|
+
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 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, ORDER_STATUSES, 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 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 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, isMessagingAPIError, listingShareUrl, storeShareUrl };
|
package/dist/index.js
CHANGED
|
@@ -1402,61 +1402,23 @@ var MessagesModule = class {
|
|
|
1402
1402
|
this.client = client;
|
|
1403
1403
|
}
|
|
1404
1404
|
client;
|
|
1405
|
-
/**
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
);
|
|
1405
|
+
/**
|
|
1406
|
+
* Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
|
|
1407
|
+
* a store blocks a buyer (`{ buyer_id }`). Idempotent.
|
|
1408
|
+
*/
|
|
1409
|
+
async createMessagingBlock(perspective, input, options) {
|
|
1410
|
+
const value = await this.client.post(`${perspectiveBase(perspective)}/blocks`, input, options);
|
|
1411
|
+
return unwrap(value, isIdentified);
|
|
1412
1412
|
}
|
|
1413
|
-
/**
|
|
1414
|
-
async
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
storeId ? { store_id: storeId } : void 0,
|
|
1418
|
-
options
|
|
1419
|
-
);
|
|
1413
|
+
/** Remove a block the current perspective created. */
|
|
1414
|
+
async removeMessagingBlock(perspective, blockId, options) {
|
|
1415
|
+
const value = await this.client.delete(`${perspectiveBase(perspective)}/blocks/${encode(blockId)}`, void 0, options);
|
|
1416
|
+
return unwrap(value, isRecord2);
|
|
1420
1417
|
}
|
|
1421
|
-
/**
|
|
1422
|
-
async
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
/** @deprecated Use advanceThreadReadCursor for precise monotonic state. */
|
|
1426
|
-
async markRead(partnerId, storeId, options) {
|
|
1427
|
-
const path = storeId ? `/notify/messages/${partnerId}/read?store_id=${storeId}` : `/notify/messages/${partnerId}/read`;
|
|
1428
|
-
return this.client.post(path, void 0, options);
|
|
1429
|
-
}
|
|
1430
|
-
/** @deprecated Use managed messaging realtime. */
|
|
1431
|
-
connectTyping(partnerId) {
|
|
1432
|
-
const token = this.client.getToken();
|
|
1433
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/${partnerId}/ws?token=${token}`;
|
|
1434
|
-
return new WebSocket(wsUrl);
|
|
1435
|
-
}
|
|
1436
|
-
/** @deprecated Use managed messaging realtime. */
|
|
1437
|
-
connectInbox() {
|
|
1438
|
-
const token = this.client.getToken();
|
|
1439
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/inbox?token=${token}`;
|
|
1440
|
-
return new WebSocket(wsUrl);
|
|
1441
|
-
}
|
|
1442
|
-
/** Create a legacy inbox socket only after hydrating/refreshing the access token. */
|
|
1443
|
-
async connectInboxFresh(options) {
|
|
1444
|
-
await this.client.ensureFreshToken(options);
|
|
1445
|
-
const token = this.client.getToken() ?? "";
|
|
1446
|
-
const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/inbox?token=${encode(token)}`;
|
|
1447
|
-
return this.client.createWebSocket(wsUrl, []);
|
|
1448
|
-
}
|
|
1449
|
-
/** Create a report for a message or conversation. */
|
|
1450
|
-
async createReport(input, options) {
|
|
1451
|
-
return this.client.post("/notify/messages/reports", input, options);
|
|
1452
|
-
}
|
|
1453
|
-
/** Create an idempotent bilateral buyer/store relationship block. */
|
|
1454
|
-
async createBlock(input, options) {
|
|
1455
|
-
return this.client.post("/notify/messages/blocks", input, options);
|
|
1456
|
-
}
|
|
1457
|
-
/** Remove a block created by the current perspective. */
|
|
1458
|
-
async removeBlock(blockId, options) {
|
|
1459
|
-
return this.client.delete(`/notify/messages/blocks/${encode(blockId)}`, void 0, options);
|
|
1418
|
+
/** File a message or conversation report from a v2 inbox perspective. Idempotent on open reports. */
|
|
1419
|
+
async createMessagingReport(perspective, input, options) {
|
|
1420
|
+
const value = await this.client.post(`${perspectiveBase(perspective)}/reports`, input, options);
|
|
1421
|
+
return unwrap(value, isIdentified);
|
|
1460
1422
|
}
|
|
1461
1423
|
/** Discover server messaging capabilities. */
|
|
1462
1424
|
async getMessagingCapabilities(options) {
|
|
@@ -2315,6 +2277,33 @@ var WholesaleModule = class {
|
|
|
2315
2277
|
async myBales(options) {
|
|
2316
2278
|
return this.client.get("/listings/wholesale/mine/bales", void 0, options);
|
|
2317
2279
|
}
|
|
2280
|
+
// ── Bale Images ──
|
|
2281
|
+
/**
|
|
2282
|
+
* Presign a bale image upload slot (requires the owning wholesale store).
|
|
2283
|
+
*
|
|
2284
|
+
* @param baleId - The bale to attach the image to
|
|
2285
|
+
* @param index - The slot index; slot 0 is the cover
|
|
2286
|
+
* @returns The storage key and image id for the slot
|
|
2287
|
+
* @throws {APIError} On network or server errors
|
|
2288
|
+
*/
|
|
2289
|
+
async presignBaleImage(baleId, index, options) {
|
|
2290
|
+
return this.client.post(`/listings/bales/${baleId}/images/presign`, { index }, options);
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Upload a bale image file directly. Uses multipart/form-data. Slot 0 is the cover.
|
|
2294
|
+
*
|
|
2295
|
+
* @param baleId - The bale to attach the image to
|
|
2296
|
+
* @param file - The image file as a `Blob` (React Native passes a `{ uri, name, type }` part)
|
|
2297
|
+
* @param index - The slot index; slot 0 is the cover
|
|
2298
|
+
* @returns The storage key, image id, and public URL
|
|
2299
|
+
* @throws {APIError} On network or server errors
|
|
2300
|
+
*/
|
|
2301
|
+
async uploadBaleImage(baleId, file, index, options) {
|
|
2302
|
+
const formData = new FormData();
|
|
2303
|
+
formData.append("file", file);
|
|
2304
|
+
formData.append("index", String(index));
|
|
2305
|
+
return this.client.post(`/listings/bales/${baleId}/images/upload`, formData, options);
|
|
2306
|
+
}
|
|
2318
2307
|
// ── Feed ──
|
|
2319
2308
|
/** Browse the wholesale bale feed (public). */
|
|
2320
2309
|
async wholesaleFeed(params, options) {
|
|
@@ -2345,6 +2334,25 @@ var WholesaleModule = class {
|
|
|
2345
2334
|
async transitionBaleOrder(id, action, options) {
|
|
2346
2335
|
return this.client.post(`/listings/bale-orders/${id}/transition`, { action }, options);
|
|
2347
2336
|
}
|
|
2337
|
+
// ── Analytics ──
|
|
2338
|
+
/**
|
|
2339
|
+
* Get performance analytics for the current user's wholesale store (bale_seller only).
|
|
2340
|
+
*
|
|
2341
|
+
* The wholesale store is resolved server-side from the session, so no store id is passed — the
|
|
2342
|
+
* same way `getWholesaleStore`, `myBales`, and `incomingBaleOrders` work.
|
|
2343
|
+
*
|
|
2344
|
+
* @param period - Optional granularity; defaults to the server's default window
|
|
2345
|
+
* @returns Revenue series, order breakdown, top bales, and totals
|
|
2346
|
+
* @throws {APIError} On network or server errors
|
|
2347
|
+
*
|
|
2348
|
+
* @example
|
|
2349
|
+
* ```typescript
|
|
2350
|
+
* const analytics = await sdk.wholesale.getAnalytics('weekly')
|
|
2351
|
+
* ```
|
|
2352
|
+
*/
|
|
2353
|
+
async getAnalytics(period, options) {
|
|
2354
|
+
return this.client.get("/listings/wholesale/analytics", period ? { period } : void 0, options);
|
|
2355
|
+
}
|
|
2348
2356
|
};
|
|
2349
2357
|
|
|
2350
2358
|
// src/types/auth.ts
|