@mitumba/sdk 1.24.1 → 1.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -85,7 +85,7 @@ interface Verify2FAInput {
85
85
  code: string;
86
86
  method_id?: string;
87
87
  }
88
- declare const TWO_FACTOR_METHOD_TYPES: readonly ["totp", "sms", "email"];
88
+ declare const TWO_FACTOR_METHOD_TYPES: readonly ["totp", "sms", "email", "passkey"];
89
89
  type TwoFactorMethodType = typeof TWO_FACTOR_METHOD_TYPES[number];
90
90
  interface TwoFactorMethod {
91
91
  id: string;
@@ -107,9 +107,84 @@ interface Add2FAMethodResult {
107
107
  otpauth_uri?: string;
108
108
  secret?: string;
109
109
  }
110
+ /** WebAuthn L2 JSON — options returned by the server for navigator.credentials.create() */
111
+ interface PublicKeyCredentialCreationOptionsJSON {
112
+ rp: {
113
+ name: string;
114
+ id?: string;
115
+ };
116
+ user: {
117
+ id: string;
118
+ name: string;
119
+ displayName: string;
120
+ };
121
+ challenge: string;
122
+ pubKeyCredParams: {
123
+ type: string;
124
+ alg: number;
125
+ }[];
126
+ timeout?: number;
127
+ excludeCredentials?: {
128
+ id: string;
129
+ type: string;
130
+ transports?: string[];
131
+ }[];
132
+ authenticatorSelection?: {
133
+ authenticatorAttachment?: string;
134
+ residentKey?: string;
135
+ requireResidentKey?: boolean;
136
+ userVerification?: string;
137
+ };
138
+ attestation?: string;
139
+ extensions?: Record<string, unknown>;
140
+ }
141
+ /** WebAuthn L2 JSON — the browser's response from navigator.credentials.create() */
142
+ interface RegistrationResponseJSON {
143
+ id: string;
144
+ rawId: string;
145
+ response: {
146
+ clientDataJSON: string;
147
+ attestationObject: string;
148
+ transports?: string[];
149
+ };
150
+ type: string;
151
+ clientExtensionResults?: Record<string, unknown>;
152
+ authenticatorAttachment?: string;
153
+ }
154
+ /** WebAuthn L2 JSON — options returned by the server for navigator.credentials.get() */
155
+ interface PublicKeyCredentialRequestOptionsJSON {
156
+ challenge: string;
157
+ timeout?: number;
158
+ rpId?: string;
159
+ allowCredentials?: {
160
+ id: string;
161
+ type: string;
162
+ transports?: string[];
163
+ }[];
164
+ userVerification?: string;
165
+ extensions?: Record<string, unknown>;
166
+ }
167
+ /** WebAuthn L2 JSON — the browser's response from navigator.credentials.get() */
168
+ interface AuthenticationResponseJSON {
169
+ id: string;
170
+ rawId: string;
171
+ response: {
172
+ clientDataJSON: string;
173
+ authenticatorData: string;
174
+ signature: string;
175
+ userHandle?: string;
176
+ };
177
+ type: string;
178
+ clientExtensionResults?: Record<string, unknown>;
179
+ authenticatorAttachment?: string;
180
+ }
181
+ type BusinessType = 'individual' | 'business';
182
+ type SellerType = 'retail' | 'bale';
110
183
  interface BecomeSellerInput {
111
- seller_type: 'individual' | 'business';
112
- sti_score: number;
184
+ business_type?: BusinessType;
185
+ /** @deprecated Use business_type instead */
186
+ seller_type?: 'individual' | 'business';
187
+ sti_score?: number;
113
188
  business_name?: string;
114
189
  id_number?: string;
115
190
  kra_pin?: string;
@@ -128,6 +203,9 @@ interface UserProfile {
128
203
  phone: string | null;
129
204
  display_name: string | null;
130
205
  city_id: string | null;
206
+ county: string | null;
207
+ bio: string | null;
208
+ avatar_url: string | null;
131
209
  onboarding_completed: boolean;
132
210
  email_verified: boolean;
133
211
  totp_enabled: boolean;
@@ -422,6 +500,16 @@ interface SendMessageInput {
422
500
  order_id?: string;
423
501
  from_store?: boolean;
424
502
  }
503
+ interface InboxRealtimeEvent {
504
+ type: 'message';
505
+ conversation_key: string;
506
+ partner_id: string;
507
+ store_id?: string | null;
508
+ from_store?: boolean;
509
+ preview: string;
510
+ created_at: string;
511
+ unread_count?: number;
512
+ }
425
513
 
426
514
  type NotificationType = 'order' | 'message' | 'price_drop' | 'offer' | 'payout' | 'system';
427
515
  interface Notification {
@@ -944,6 +1032,100 @@ interface DisputeListParams {
944
1032
  page?: number;
945
1033
  }
946
1034
 
1035
+ type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
1036
+ type BaleType = 'original' | 'sorted';
1037
+ interface WholesaleStore {
1038
+ id: string;
1039
+ name: string;
1040
+ slug: string;
1041
+ tagline: string | null;
1042
+ description: string | null;
1043
+ logo_url: string | null;
1044
+ origins: string[];
1045
+ verified: boolean;
1046
+ }
1047
+ interface WholesaleDepot {
1048
+ id: string;
1049
+ name: string;
1050
+ address: string | null;
1051
+ city_id: string | null;
1052
+ is_primary: boolean;
1053
+ }
1054
+ interface Bale {
1055
+ id: string;
1056
+ store_id: string;
1057
+ seller_id: string;
1058
+ title: string;
1059
+ category: string;
1060
+ grade: BaleGrade;
1061
+ bale_type: BaleType;
1062
+ weight_kg: number;
1063
+ origin: string | null;
1064
+ est_pieces: number | null;
1065
+ price_kes: number;
1066
+ moq: number;
1067
+ mix: string | null;
1068
+ description: string | null;
1069
+ city_id: string | null;
1070
+ status: 'draft' | 'active' | 'sold_out';
1071
+ created_at: string;
1072
+ }
1073
+ interface BaleDetail extends Bale {
1074
+ images: string[];
1075
+ store: {
1076
+ name: string;
1077
+ slug: string;
1078
+ verified: boolean;
1079
+ sti: number | null;
1080
+ };
1081
+ }
1082
+ interface CreateBaleInput {
1083
+ title: string;
1084
+ category: string;
1085
+ grade: BaleGrade;
1086
+ bale_type?: BaleType;
1087
+ weight_kg: number;
1088
+ origin?: string;
1089
+ est_pieces?: number;
1090
+ price_kes: number;
1091
+ moq?: number;
1092
+ mix?: string;
1093
+ description?: string;
1094
+ city_id?: string;
1095
+ status?: 'draft' | 'active' | 'sold_out';
1096
+ }
1097
+ interface WholesaleFeedParams {
1098
+ q?: string;
1099
+ category?: string;
1100
+ grade?: BaleGrade;
1101
+ origin?: string;
1102
+ city_id?: string;
1103
+ limit?: number;
1104
+ offset?: number;
1105
+ }
1106
+ interface BaleFeedItem extends Bale {
1107
+ image_url: string | null;
1108
+ store: {
1109
+ name: string;
1110
+ slug: string;
1111
+ verified: boolean;
1112
+ sti: number | null;
1113
+ };
1114
+ }
1115
+ interface SaveWholesaleStoreInput {
1116
+ name: string;
1117
+ tagline?: string;
1118
+ description?: string;
1119
+ logo_url?: string;
1120
+ origins?: string[];
1121
+ }
1122
+ interface AddDepotInput {
1123
+ name: string;
1124
+ address?: string;
1125
+ city_id?: string;
1126
+ is_primary?: boolean;
1127
+ }
1128
+
947
1129
  interface MitumbaClientConfig {
948
1130
  baseUrl: string;
949
1131
  debug?: boolean;
@@ -1150,6 +1332,22 @@ declare class AuthModule {
1150
1332
  }, options?: RequestOptions): Promise<{
1151
1333
  ok: true;
1152
1334
  }>;
1335
+ /**
1336
+ * Start passkey login — get assertion options for navigator.credentials.get().
1337
+ */
1338
+ startPasskeyLogin(input: {
1339
+ temp_token: string;
1340
+ method_id?: string;
1341
+ }, options?: RequestOptions): Promise<{
1342
+ options: PublicKeyCredentialRequestOptionsJSON;
1343
+ }>;
1344
+ /**
1345
+ * Finish passkey login — submit the browser's assertion response. Tokens are auto-persisted.
1346
+ */
1347
+ finishPasskeyLogin(input: {
1348
+ temp_token: string;
1349
+ credential: AuthenticationResponseJSON;
1350
+ }, options?: RequestOptions): Promise<AuthTokens>;
1153
1351
  }
1154
1352
 
1155
1353
  declare class ListingsModule {
@@ -1409,6 +1607,11 @@ declare class MessagesModule {
1409
1607
  * Token is passed via query param since WebSocket can't set headers.
1410
1608
  */
1411
1609
  connectTyping(partnerId: string): WebSocket;
1610
+ /**
1611
+ * Connect to the user-scoped inbox WebSocket.
1612
+ * Emits InboxRealtimeEvent for every inbound message across all conversations.
1613
+ */
1614
+ connectInbox(): WebSocket;
1412
1615
  }
1413
1616
 
1414
1617
  declare class NotificationsModule {
@@ -1715,6 +1918,16 @@ declare class SettingsModule {
1715
1918
  challenge2FAMethod(id: string, options?: RequestOptions): Promise<{
1716
1919
  ok: true;
1717
1920
  }>;
1921
+ startPasskeyRegistration(input?: {
1922
+ label?: string;
1923
+ }, options?: RequestOptions): Promise<{
1924
+ method_id: string;
1925
+ options: PublicKeyCredentialCreationOptionsJSON;
1926
+ }>;
1927
+ finishPasskeyRegistration(methodId: string, credential: RegistrationResponseJSON, options?: RequestOptions): Promise<{
1928
+ ok: true;
1929
+ backup_codes?: string[];
1930
+ }>;
1718
1931
  }
1719
1932
 
1720
1933
  declare class MailerModule {
@@ -2012,6 +2225,53 @@ declare class ReportsModule {
2012
2225
  }>;
2013
2226
  }
2014
2227
 
2228
+ declare class WholesaleModule {
2229
+ private readonly client;
2230
+ constructor(client: APIClient);
2231
+ /** Get the current user's wholesale store and depots. */
2232
+ getWholesaleStore(options?: RequestOptions): Promise<{
2233
+ store: WholesaleStore | null;
2234
+ depots?: WholesaleDepot[];
2235
+ }>;
2236
+ /** Create or update the wholesale store (bale_seller only). */
2237
+ saveWholesaleStore(input: SaveWholesaleStoreInput, options?: RequestOptions): Promise<{
2238
+ id: string;
2239
+ verified?: boolean;
2240
+ }>;
2241
+ /** Add a depot to the wholesale store. */
2242
+ addDepot(input: AddDepotInput, options?: RequestOptions): Promise<{
2243
+ id: string;
2244
+ }>;
2245
+ /** Remove a depot. */
2246
+ removeDepot(id: string, options?: RequestOptions): Promise<{
2247
+ ok: true;
2248
+ }>;
2249
+ /** Create a bale listing (requires verified wholesale store). */
2250
+ createBale(input: CreateBaleInput, options?: RequestOptions): Promise<{
2251
+ id: string;
2252
+ }>;
2253
+ /** Get a bale by ID (public). */
2254
+ getBale(id: string, options?: RequestOptions): Promise<BaleDetail>;
2255
+ /** Update a bale. */
2256
+ updateBale(id: string, input: Partial<CreateBaleInput>, options?: RequestOptions): Promise<{
2257
+ ok: true;
2258
+ }>;
2259
+ /** Soft-delete a bale. */
2260
+ removeBale(id: string, options?: RequestOptions): Promise<{
2261
+ ok: true;
2262
+ }>;
2263
+ /** Get all bales for the current user's wholesale store. */
2264
+ myBales(options?: RequestOptions): Promise<{
2265
+ data: Bale[];
2266
+ }>;
2267
+ /** Browse the wholesale bale feed (public). */
2268
+ wholesaleFeed(params?: WholesaleFeedParams, options?: RequestOptions): Promise<{
2269
+ data: BaleFeedItem[];
2270
+ limit: number;
2271
+ offset: number;
2272
+ }>;
2273
+ }
2274
+
2015
2275
  declare class MitumbaClient {
2016
2276
  readonly api: APIClient;
2017
2277
  readonly auth: AuthModule;
@@ -2033,6 +2293,7 @@ declare class MitumbaClient {
2033
2293
  readonly disputes: DisputesModule;
2034
2294
  readonly uploads: UploadsModule;
2035
2295
  readonly reports: ReportsModule;
2296
+ readonly wholesale: WholesaleModule;
2036
2297
  constructor(config: MitumbaClientConfig);
2037
2298
  /**
2038
2299
  * Set the access token for authenticated requests.
@@ -2064,4 +2325,4 @@ declare class MitumbaClient {
2064
2325
  isAuthenticated(): Promise<boolean>;
2065
2326
  }
2066
2327
 
2067
- export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type BecomeSellerInput, type BlockedIp, type Business, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, 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, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type RaiseDisputeInput, type RegisterInput, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
2328
+ export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type AuthenticationResponseJSON, type Bale, type BaleDetail, type BaleFeedItem, type BaleGrade, type BaleType, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateBaleInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, 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, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };
package/dist/index.d.ts CHANGED
@@ -85,7 +85,7 @@ interface Verify2FAInput {
85
85
  code: string;
86
86
  method_id?: string;
87
87
  }
88
- declare const TWO_FACTOR_METHOD_TYPES: readonly ["totp", "sms", "email"];
88
+ declare const TWO_FACTOR_METHOD_TYPES: readonly ["totp", "sms", "email", "passkey"];
89
89
  type TwoFactorMethodType = typeof TWO_FACTOR_METHOD_TYPES[number];
90
90
  interface TwoFactorMethod {
91
91
  id: string;
@@ -107,9 +107,84 @@ interface Add2FAMethodResult {
107
107
  otpauth_uri?: string;
108
108
  secret?: string;
109
109
  }
110
+ /** WebAuthn L2 JSON — options returned by the server for navigator.credentials.create() */
111
+ interface PublicKeyCredentialCreationOptionsJSON {
112
+ rp: {
113
+ name: string;
114
+ id?: string;
115
+ };
116
+ user: {
117
+ id: string;
118
+ name: string;
119
+ displayName: string;
120
+ };
121
+ challenge: string;
122
+ pubKeyCredParams: {
123
+ type: string;
124
+ alg: number;
125
+ }[];
126
+ timeout?: number;
127
+ excludeCredentials?: {
128
+ id: string;
129
+ type: string;
130
+ transports?: string[];
131
+ }[];
132
+ authenticatorSelection?: {
133
+ authenticatorAttachment?: string;
134
+ residentKey?: string;
135
+ requireResidentKey?: boolean;
136
+ userVerification?: string;
137
+ };
138
+ attestation?: string;
139
+ extensions?: Record<string, unknown>;
140
+ }
141
+ /** WebAuthn L2 JSON — the browser's response from navigator.credentials.create() */
142
+ interface RegistrationResponseJSON {
143
+ id: string;
144
+ rawId: string;
145
+ response: {
146
+ clientDataJSON: string;
147
+ attestationObject: string;
148
+ transports?: string[];
149
+ };
150
+ type: string;
151
+ clientExtensionResults?: Record<string, unknown>;
152
+ authenticatorAttachment?: string;
153
+ }
154
+ /** WebAuthn L2 JSON — options returned by the server for navigator.credentials.get() */
155
+ interface PublicKeyCredentialRequestOptionsJSON {
156
+ challenge: string;
157
+ timeout?: number;
158
+ rpId?: string;
159
+ allowCredentials?: {
160
+ id: string;
161
+ type: string;
162
+ transports?: string[];
163
+ }[];
164
+ userVerification?: string;
165
+ extensions?: Record<string, unknown>;
166
+ }
167
+ /** WebAuthn L2 JSON — the browser's response from navigator.credentials.get() */
168
+ interface AuthenticationResponseJSON {
169
+ id: string;
170
+ rawId: string;
171
+ response: {
172
+ clientDataJSON: string;
173
+ authenticatorData: string;
174
+ signature: string;
175
+ userHandle?: string;
176
+ };
177
+ type: string;
178
+ clientExtensionResults?: Record<string, unknown>;
179
+ authenticatorAttachment?: string;
180
+ }
181
+ type BusinessType = 'individual' | 'business';
182
+ type SellerType = 'retail' | 'bale';
110
183
  interface BecomeSellerInput {
111
- seller_type: 'individual' | 'business';
112
- sti_score: number;
184
+ business_type?: BusinessType;
185
+ /** @deprecated Use business_type instead */
186
+ seller_type?: 'individual' | 'business';
187
+ sti_score?: number;
113
188
  business_name?: string;
114
189
  id_number?: string;
115
190
  kra_pin?: string;
@@ -128,6 +203,9 @@ interface UserProfile {
128
203
  phone: string | null;
129
204
  display_name: string | null;
130
205
  city_id: string | null;
206
+ county: string | null;
207
+ bio: string | null;
208
+ avatar_url: string | null;
131
209
  onboarding_completed: boolean;
132
210
  email_verified: boolean;
133
211
  totp_enabled: boolean;
@@ -422,6 +500,16 @@ interface SendMessageInput {
422
500
  order_id?: string;
423
501
  from_store?: boolean;
424
502
  }
503
+ interface InboxRealtimeEvent {
504
+ type: 'message';
505
+ conversation_key: string;
506
+ partner_id: string;
507
+ store_id?: string | null;
508
+ from_store?: boolean;
509
+ preview: string;
510
+ created_at: string;
511
+ unread_count?: number;
512
+ }
425
513
 
426
514
  type NotificationType = 'order' | 'message' | 'price_drop' | 'offer' | 'payout' | 'system';
427
515
  interface Notification {
@@ -944,6 +1032,100 @@ interface DisputeListParams {
944
1032
  page?: number;
945
1033
  }
946
1034
 
1035
+ type BaleGrade = 'Cream' | 'A' | 'B' | 'C';
1036
+ type BaleType = 'original' | 'sorted';
1037
+ interface WholesaleStore {
1038
+ id: string;
1039
+ name: string;
1040
+ slug: string;
1041
+ tagline: string | null;
1042
+ description: string | null;
1043
+ logo_url: string | null;
1044
+ origins: string[];
1045
+ verified: boolean;
1046
+ }
1047
+ interface WholesaleDepot {
1048
+ id: string;
1049
+ name: string;
1050
+ address: string | null;
1051
+ city_id: string | null;
1052
+ is_primary: boolean;
1053
+ }
1054
+ interface Bale {
1055
+ id: string;
1056
+ store_id: string;
1057
+ seller_id: string;
1058
+ title: string;
1059
+ category: string;
1060
+ grade: BaleGrade;
1061
+ bale_type: BaleType;
1062
+ weight_kg: number;
1063
+ origin: string | null;
1064
+ est_pieces: number | null;
1065
+ price_kes: number;
1066
+ moq: number;
1067
+ mix: string | null;
1068
+ description: string | null;
1069
+ city_id: string | null;
1070
+ status: 'draft' | 'active' | 'sold_out';
1071
+ created_at: string;
1072
+ }
1073
+ interface BaleDetail extends Bale {
1074
+ images: string[];
1075
+ store: {
1076
+ name: string;
1077
+ slug: string;
1078
+ verified: boolean;
1079
+ sti: number | null;
1080
+ };
1081
+ }
1082
+ interface CreateBaleInput {
1083
+ title: string;
1084
+ category: string;
1085
+ grade: BaleGrade;
1086
+ bale_type?: BaleType;
1087
+ weight_kg: number;
1088
+ origin?: string;
1089
+ est_pieces?: number;
1090
+ price_kes: number;
1091
+ moq?: number;
1092
+ mix?: string;
1093
+ description?: string;
1094
+ city_id?: string;
1095
+ status?: 'draft' | 'active' | 'sold_out';
1096
+ }
1097
+ interface WholesaleFeedParams {
1098
+ q?: string;
1099
+ category?: string;
1100
+ grade?: BaleGrade;
1101
+ origin?: string;
1102
+ city_id?: string;
1103
+ limit?: number;
1104
+ offset?: number;
1105
+ }
1106
+ interface BaleFeedItem extends Bale {
1107
+ image_url: string | null;
1108
+ store: {
1109
+ name: string;
1110
+ slug: string;
1111
+ verified: boolean;
1112
+ sti: number | null;
1113
+ };
1114
+ }
1115
+ interface SaveWholesaleStoreInput {
1116
+ name: string;
1117
+ tagline?: string;
1118
+ description?: string;
1119
+ logo_url?: string;
1120
+ origins?: string[];
1121
+ }
1122
+ interface AddDepotInput {
1123
+ name: string;
1124
+ address?: string;
1125
+ city_id?: string;
1126
+ is_primary?: boolean;
1127
+ }
1128
+
947
1129
  interface MitumbaClientConfig {
948
1130
  baseUrl: string;
949
1131
  debug?: boolean;
@@ -1150,6 +1332,22 @@ declare class AuthModule {
1150
1332
  }, options?: RequestOptions): Promise<{
1151
1333
  ok: true;
1152
1334
  }>;
1335
+ /**
1336
+ * Start passkey login — get assertion options for navigator.credentials.get().
1337
+ */
1338
+ startPasskeyLogin(input: {
1339
+ temp_token: string;
1340
+ method_id?: string;
1341
+ }, options?: RequestOptions): Promise<{
1342
+ options: PublicKeyCredentialRequestOptionsJSON;
1343
+ }>;
1344
+ /**
1345
+ * Finish passkey login — submit the browser's assertion response. Tokens are auto-persisted.
1346
+ */
1347
+ finishPasskeyLogin(input: {
1348
+ temp_token: string;
1349
+ credential: AuthenticationResponseJSON;
1350
+ }, options?: RequestOptions): Promise<AuthTokens>;
1153
1351
  }
1154
1352
 
1155
1353
  declare class ListingsModule {
@@ -1409,6 +1607,11 @@ declare class MessagesModule {
1409
1607
  * Token is passed via query param since WebSocket can't set headers.
1410
1608
  */
1411
1609
  connectTyping(partnerId: string): WebSocket;
1610
+ /**
1611
+ * Connect to the user-scoped inbox WebSocket.
1612
+ * Emits InboxRealtimeEvent for every inbound message across all conversations.
1613
+ */
1614
+ connectInbox(): WebSocket;
1412
1615
  }
1413
1616
 
1414
1617
  declare class NotificationsModule {
@@ -1715,6 +1918,16 @@ declare class SettingsModule {
1715
1918
  challenge2FAMethod(id: string, options?: RequestOptions): Promise<{
1716
1919
  ok: true;
1717
1920
  }>;
1921
+ startPasskeyRegistration(input?: {
1922
+ label?: string;
1923
+ }, options?: RequestOptions): Promise<{
1924
+ method_id: string;
1925
+ options: PublicKeyCredentialCreationOptionsJSON;
1926
+ }>;
1927
+ finishPasskeyRegistration(methodId: string, credential: RegistrationResponseJSON, options?: RequestOptions): Promise<{
1928
+ ok: true;
1929
+ backup_codes?: string[];
1930
+ }>;
1718
1931
  }
1719
1932
 
1720
1933
  declare class MailerModule {
@@ -2012,6 +2225,53 @@ declare class ReportsModule {
2012
2225
  }>;
2013
2226
  }
2014
2227
 
2228
+ declare class WholesaleModule {
2229
+ private readonly client;
2230
+ constructor(client: APIClient);
2231
+ /** Get the current user's wholesale store and depots. */
2232
+ getWholesaleStore(options?: RequestOptions): Promise<{
2233
+ store: WholesaleStore | null;
2234
+ depots?: WholesaleDepot[];
2235
+ }>;
2236
+ /** Create or update the wholesale store (bale_seller only). */
2237
+ saveWholesaleStore(input: SaveWholesaleStoreInput, options?: RequestOptions): Promise<{
2238
+ id: string;
2239
+ verified?: boolean;
2240
+ }>;
2241
+ /** Add a depot to the wholesale store. */
2242
+ addDepot(input: AddDepotInput, options?: RequestOptions): Promise<{
2243
+ id: string;
2244
+ }>;
2245
+ /** Remove a depot. */
2246
+ removeDepot(id: string, options?: RequestOptions): Promise<{
2247
+ ok: true;
2248
+ }>;
2249
+ /** Create a bale listing (requires verified wholesale store). */
2250
+ createBale(input: CreateBaleInput, options?: RequestOptions): Promise<{
2251
+ id: string;
2252
+ }>;
2253
+ /** Get a bale by ID (public). */
2254
+ getBale(id: string, options?: RequestOptions): Promise<BaleDetail>;
2255
+ /** Update a bale. */
2256
+ updateBale(id: string, input: Partial<CreateBaleInput>, options?: RequestOptions): Promise<{
2257
+ ok: true;
2258
+ }>;
2259
+ /** Soft-delete a bale. */
2260
+ removeBale(id: string, options?: RequestOptions): Promise<{
2261
+ ok: true;
2262
+ }>;
2263
+ /** Get all bales for the current user's wholesale store. */
2264
+ myBales(options?: RequestOptions): Promise<{
2265
+ data: Bale[];
2266
+ }>;
2267
+ /** Browse the wholesale bale feed (public). */
2268
+ wholesaleFeed(params?: WholesaleFeedParams, options?: RequestOptions): Promise<{
2269
+ data: BaleFeedItem[];
2270
+ limit: number;
2271
+ offset: number;
2272
+ }>;
2273
+ }
2274
+
2015
2275
  declare class MitumbaClient {
2016
2276
  readonly api: APIClient;
2017
2277
  readonly auth: AuthModule;
@@ -2033,6 +2293,7 @@ declare class MitumbaClient {
2033
2293
  readonly disputes: DisputesModule;
2034
2294
  readonly uploads: UploadsModule;
2035
2295
  readonly reports: ReportsModule;
2296
+ readonly wholesale: WholesaleModule;
2036
2297
  constructor(config: MitumbaClientConfig);
2037
2298
  /**
2038
2299
  * Set the access token for authenticated requests.
@@ -2064,4 +2325,4 @@ declare class MitumbaClient {
2064
2325
  isAuthenticated(): Promise<boolean>;
2065
2326
  }
2066
2327
 
2067
- export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type BecomeSellerInput, type BlockedIp, type Business, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, 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, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type RaiseDisputeInput, type RegisterInput, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
2328
+ export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminListingItem, AdminModule, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminReport, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, AuthModule, type AuthTokens, type AuthenticationResponseJSON, type Bale, type BaleDetail, type BaleFeedItem, type BaleGrade, type BaleType, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateBaleInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, 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, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentMethod, type PaymentMethodType, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };