@mitumba/sdk 0.16.0 → 0.18.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 +151 -3
- package/dist/index.d.ts +151 -3
- package/dist/index.js +98 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ interface EmailRegisterInput {
|
|
|
10
10
|
email: string;
|
|
11
11
|
password: string;
|
|
12
12
|
display_name?: string;
|
|
13
|
+
device?: string;
|
|
13
14
|
}
|
|
14
15
|
interface PhoneRegisterInput {
|
|
15
16
|
phone: string;
|
|
@@ -18,6 +19,7 @@ type RegisterInput = EmailRegisterInput | PhoneRegisterInput;
|
|
|
18
19
|
interface EmailLoginInput {
|
|
19
20
|
email: string;
|
|
20
21
|
password: string;
|
|
22
|
+
device?: string;
|
|
21
23
|
}
|
|
22
24
|
interface PhoneLoginInput {
|
|
23
25
|
phone: string;
|
|
@@ -42,6 +44,14 @@ interface CompleteOnboardingInput {
|
|
|
42
44
|
county: string;
|
|
43
45
|
phone: string;
|
|
44
46
|
}
|
|
47
|
+
interface TwoFactorRequired {
|
|
48
|
+
requires_2fa: true;
|
|
49
|
+
temp_token: string;
|
|
50
|
+
}
|
|
51
|
+
interface Verify2FAInput {
|
|
52
|
+
temp_token: string;
|
|
53
|
+
code: string;
|
|
54
|
+
}
|
|
45
55
|
interface UserProfile {
|
|
46
56
|
id: string;
|
|
47
57
|
email: string | null;
|
|
@@ -371,6 +381,62 @@ interface CartItem {
|
|
|
371
381
|
added_at: string;
|
|
372
382
|
}
|
|
373
383
|
|
|
384
|
+
interface UpdateProfileInput {
|
|
385
|
+
display_name?: string;
|
|
386
|
+
phone?: string;
|
|
387
|
+
county?: string;
|
|
388
|
+
bio?: string;
|
|
389
|
+
avatar_url?: string;
|
|
390
|
+
}
|
|
391
|
+
interface ChangePasswordInput {
|
|
392
|
+
current_password: string;
|
|
393
|
+
new_password: string;
|
|
394
|
+
}
|
|
395
|
+
interface Session {
|
|
396
|
+
id: string;
|
|
397
|
+
device: string;
|
|
398
|
+
location: string;
|
|
399
|
+
last_active: string;
|
|
400
|
+
is_current: boolean;
|
|
401
|
+
}
|
|
402
|
+
interface NotificationPref {
|
|
403
|
+
channel: string;
|
|
404
|
+
enabled: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface Address {
|
|
407
|
+
id: string;
|
|
408
|
+
label: string;
|
|
409
|
+
name: string;
|
|
410
|
+
phone: string;
|
|
411
|
+
line1: string;
|
|
412
|
+
line2: string | null;
|
|
413
|
+
city: string;
|
|
414
|
+
county: string;
|
|
415
|
+
is_default: boolean;
|
|
416
|
+
created_at: string;
|
|
417
|
+
}
|
|
418
|
+
type AddAddressInput = Omit<Address, 'id' | 'is_default' | 'created_at'>;
|
|
419
|
+
type PaymentMethodType = 'mpesa' | 'mpesa_till' | 'airtel' | 'telkom' | 'card';
|
|
420
|
+
interface PaymentMethod {
|
|
421
|
+
id: string;
|
|
422
|
+
type: PaymentMethodType;
|
|
423
|
+
label: string;
|
|
424
|
+
detail: string;
|
|
425
|
+
is_default: boolean;
|
|
426
|
+
created_at: string;
|
|
427
|
+
}
|
|
428
|
+
interface AddPaymentMethodInput {
|
|
429
|
+
type: PaymentMethodType;
|
|
430
|
+
label: string;
|
|
431
|
+
detail: string;
|
|
432
|
+
}
|
|
433
|
+
type LinkedAccountProvider = 'google' | 'apple';
|
|
434
|
+
interface LinkedAccount {
|
|
435
|
+
provider: LinkedAccountProvider;
|
|
436
|
+
email: string | null;
|
|
437
|
+
connected_at: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
374
440
|
interface MitumbaClientConfig {
|
|
375
441
|
baseUrl: string;
|
|
376
442
|
debug?: boolean;
|
|
@@ -444,10 +510,10 @@ declare class AuthModule {
|
|
|
444
510
|
register(input: RegisterInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse>;
|
|
445
511
|
/**
|
|
446
512
|
* Log in to an existing account.
|
|
447
|
-
* If using EmailLoginInput, returns AuthTokens.
|
|
513
|
+
* If using EmailLoginInput, returns AuthTokens (or TwoFactorRequired if 2FA enabled).
|
|
448
514
|
* If using PhoneLoginInput, returns MessageResponse (OTP sent).
|
|
449
515
|
*/
|
|
450
|
-
login(input: LoginInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse>;
|
|
516
|
+
login(input: LoginInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse | TwoFactorRequired>;
|
|
451
517
|
/**
|
|
452
518
|
* Send an OTP code to a phone number.
|
|
453
519
|
*/
|
|
@@ -489,6 +555,10 @@ declare class AuthModule {
|
|
|
489
555
|
completeOnboarding(input: CompleteOnboardingInput, options?: RequestOptions): Promise<{
|
|
490
556
|
ok: true;
|
|
491
557
|
}>;
|
|
558
|
+
/**
|
|
559
|
+
* Verify 2FA code during login (when login returns requires_2fa).
|
|
560
|
+
*/
|
|
561
|
+
verify2FA(input: Verify2FAInput, options?: RequestOptions): Promise<AuthTokens>;
|
|
492
562
|
}
|
|
493
563
|
|
|
494
564
|
declare class ListingsModule {
|
|
@@ -827,6 +897,83 @@ declare class CartModule {
|
|
|
827
897
|
}>;
|
|
828
898
|
}
|
|
829
899
|
|
|
900
|
+
declare class SettingsModule {
|
|
901
|
+
private readonly client;
|
|
902
|
+
constructor(client: APIClient);
|
|
903
|
+
getProfile(options?: RequestOptions): Promise<UserProfile>;
|
|
904
|
+
updateProfile(input: UpdateProfileInput, options?: RequestOptions): Promise<{
|
|
905
|
+
ok: true;
|
|
906
|
+
}>;
|
|
907
|
+
changePassword(input: ChangePasswordInput, options?: RequestOptions): Promise<{
|
|
908
|
+
ok: true;
|
|
909
|
+
}>;
|
|
910
|
+
getSessions(options?: RequestOptions): Promise<{
|
|
911
|
+
data: Session[];
|
|
912
|
+
}>;
|
|
913
|
+
revokeSession(sessionId: string, options?: RequestOptions): Promise<{
|
|
914
|
+
ok: true;
|
|
915
|
+
}>;
|
|
916
|
+
getNotificationPrefs(options?: RequestOptions): Promise<{
|
|
917
|
+
data: NotificationPref[];
|
|
918
|
+
}>;
|
|
919
|
+
updateNotificationPref(channel: string, enabled: boolean, options?: RequestOptions): Promise<{
|
|
920
|
+
ok: true;
|
|
921
|
+
}>;
|
|
922
|
+
getPreferences(options?: RequestOptions): Promise<{
|
|
923
|
+
data: Record<string, string>;
|
|
924
|
+
}>;
|
|
925
|
+
updatePreferences(prefs: Record<string, string>, options?: RequestOptions): Promise<{
|
|
926
|
+
ok: true;
|
|
927
|
+
}>;
|
|
928
|
+
getAddresses(options?: RequestOptions): Promise<{
|
|
929
|
+
data: Address[];
|
|
930
|
+
}>;
|
|
931
|
+
addAddress(input: AddAddressInput, options?: RequestOptions): Promise<{
|
|
932
|
+
id: string;
|
|
933
|
+
}>;
|
|
934
|
+
updateAddress(id: string, input: Partial<AddAddressInput>, options?: RequestOptions): Promise<{
|
|
935
|
+
ok: true;
|
|
936
|
+
}>;
|
|
937
|
+
deleteAddress(id: string, options?: RequestOptions): Promise<{
|
|
938
|
+
ok: true;
|
|
939
|
+
}>;
|
|
940
|
+
setDefaultAddress(id: string, options?: RequestOptions): Promise<{
|
|
941
|
+
ok: true;
|
|
942
|
+
}>;
|
|
943
|
+
getPaymentMethods(options?: RequestOptions): Promise<{
|
|
944
|
+
data: PaymentMethod[];
|
|
945
|
+
}>;
|
|
946
|
+
addPaymentMethod(input: AddPaymentMethodInput, options?: RequestOptions): Promise<{
|
|
947
|
+
id: string;
|
|
948
|
+
}>;
|
|
949
|
+
deletePaymentMethod(id: string, options?: RequestOptions): Promise<{
|
|
950
|
+
ok: true;
|
|
951
|
+
}>;
|
|
952
|
+
setDefaultPaymentMethod(id: string, options?: RequestOptions): Promise<{
|
|
953
|
+
ok: true;
|
|
954
|
+
}>;
|
|
955
|
+
getLinkedAccounts(options?: RequestOptions): Promise<{
|
|
956
|
+
data: LinkedAccount[];
|
|
957
|
+
}>;
|
|
958
|
+
linkAccount(provider: LinkedAccountProvider, token: string, options?: RequestOptions): Promise<{
|
|
959
|
+
ok: true;
|
|
960
|
+
}>;
|
|
961
|
+
unlinkAccount(provider: LinkedAccountProvider, options?: RequestOptions): Promise<{
|
|
962
|
+
ok: true;
|
|
963
|
+
}>;
|
|
964
|
+
setup2FA(options?: RequestOptions): Promise<{
|
|
965
|
+
secret: string;
|
|
966
|
+
otpauth_uri: string;
|
|
967
|
+
}>;
|
|
968
|
+
verify2FA(code: string, options?: RequestOptions): Promise<{
|
|
969
|
+
ok: true;
|
|
970
|
+
backup_codes: string[];
|
|
971
|
+
}>;
|
|
972
|
+
disable2FA(code: string, options?: RequestOptions): Promise<{
|
|
973
|
+
ok: true;
|
|
974
|
+
}>;
|
|
975
|
+
}
|
|
976
|
+
|
|
830
977
|
declare class MitumbaClient {
|
|
831
978
|
readonly api: APIClient;
|
|
832
979
|
readonly auth: AuthModule;
|
|
@@ -841,6 +988,7 @@ declare class MitumbaClient {
|
|
|
841
988
|
readonly reviews: ReviewsModule;
|
|
842
989
|
readonly wishlists: WishlistsModule;
|
|
843
990
|
readonly cart: CartModule;
|
|
991
|
+
readonly settings: SettingsModule;
|
|
844
992
|
constructor(config: MitumbaClientConfig);
|
|
845
993
|
/**
|
|
846
994
|
* Set the access token for authenticated requests.
|
|
@@ -857,4 +1005,4 @@ declare class MitumbaClient {
|
|
|
857
1005
|
clearToken(): void;
|
|
858
1006
|
}
|
|
859
1007
|
|
|
860
|
-
export { APIClient, APIError, type APIErrorResponse, AuthModule, type AuthTokens, CONDITIONS, type CartItem, CartModule, type Category, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type EmailLoginInput, type EmailRegisterInput, type ForgotPasswordInput, GARMENT_TYPES, type GarmentType, LISTING_STATUSES, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type RegisterInput, type RequestOptions, type ResetPasswordInput, type Review, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendMessageInput, type SendOtpInput, type SimilarListing, type StkPushInput, type StkPushResponse, type Store, StoresModule, type SubscriptionTier, type TransitionOrderInput, type TrendingTerm, type UpdateListingInput, type UserProfile, type VAZIOutfit, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type VerifyOtpInput, type WishlistListing, WishlistsModule };
|
|
1008
|
+
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AuthModule, type AuthTokens, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type EmailLoginInput, type EmailRegisterInput, type ForgotPasswordInput, GARMENT_TYPES, type GarmentType, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, 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 RegisterInput, type RequestOptions, type ResetPasswordInput, type Review, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StkPushInput, type StkPushResponse, type Store, StoresModule, type SubscriptionTier, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateListingInput, type UpdateProfileInput, type UserProfile, type VAZIOutfit, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule };
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ interface EmailRegisterInput {
|
|
|
10
10
|
email: string;
|
|
11
11
|
password: string;
|
|
12
12
|
display_name?: string;
|
|
13
|
+
device?: string;
|
|
13
14
|
}
|
|
14
15
|
interface PhoneRegisterInput {
|
|
15
16
|
phone: string;
|
|
@@ -18,6 +19,7 @@ type RegisterInput = EmailRegisterInput | PhoneRegisterInput;
|
|
|
18
19
|
interface EmailLoginInput {
|
|
19
20
|
email: string;
|
|
20
21
|
password: string;
|
|
22
|
+
device?: string;
|
|
21
23
|
}
|
|
22
24
|
interface PhoneLoginInput {
|
|
23
25
|
phone: string;
|
|
@@ -42,6 +44,14 @@ interface CompleteOnboardingInput {
|
|
|
42
44
|
county: string;
|
|
43
45
|
phone: string;
|
|
44
46
|
}
|
|
47
|
+
interface TwoFactorRequired {
|
|
48
|
+
requires_2fa: true;
|
|
49
|
+
temp_token: string;
|
|
50
|
+
}
|
|
51
|
+
interface Verify2FAInput {
|
|
52
|
+
temp_token: string;
|
|
53
|
+
code: string;
|
|
54
|
+
}
|
|
45
55
|
interface UserProfile {
|
|
46
56
|
id: string;
|
|
47
57
|
email: string | null;
|
|
@@ -371,6 +381,62 @@ interface CartItem {
|
|
|
371
381
|
added_at: string;
|
|
372
382
|
}
|
|
373
383
|
|
|
384
|
+
interface UpdateProfileInput {
|
|
385
|
+
display_name?: string;
|
|
386
|
+
phone?: string;
|
|
387
|
+
county?: string;
|
|
388
|
+
bio?: string;
|
|
389
|
+
avatar_url?: string;
|
|
390
|
+
}
|
|
391
|
+
interface ChangePasswordInput {
|
|
392
|
+
current_password: string;
|
|
393
|
+
new_password: string;
|
|
394
|
+
}
|
|
395
|
+
interface Session {
|
|
396
|
+
id: string;
|
|
397
|
+
device: string;
|
|
398
|
+
location: string;
|
|
399
|
+
last_active: string;
|
|
400
|
+
is_current: boolean;
|
|
401
|
+
}
|
|
402
|
+
interface NotificationPref {
|
|
403
|
+
channel: string;
|
|
404
|
+
enabled: boolean;
|
|
405
|
+
}
|
|
406
|
+
interface Address {
|
|
407
|
+
id: string;
|
|
408
|
+
label: string;
|
|
409
|
+
name: string;
|
|
410
|
+
phone: string;
|
|
411
|
+
line1: string;
|
|
412
|
+
line2: string | null;
|
|
413
|
+
city: string;
|
|
414
|
+
county: string;
|
|
415
|
+
is_default: boolean;
|
|
416
|
+
created_at: string;
|
|
417
|
+
}
|
|
418
|
+
type AddAddressInput = Omit<Address, 'id' | 'is_default' | 'created_at'>;
|
|
419
|
+
type PaymentMethodType = 'mpesa' | 'mpesa_till' | 'airtel' | 'telkom' | 'card';
|
|
420
|
+
interface PaymentMethod {
|
|
421
|
+
id: string;
|
|
422
|
+
type: PaymentMethodType;
|
|
423
|
+
label: string;
|
|
424
|
+
detail: string;
|
|
425
|
+
is_default: boolean;
|
|
426
|
+
created_at: string;
|
|
427
|
+
}
|
|
428
|
+
interface AddPaymentMethodInput {
|
|
429
|
+
type: PaymentMethodType;
|
|
430
|
+
label: string;
|
|
431
|
+
detail: string;
|
|
432
|
+
}
|
|
433
|
+
type LinkedAccountProvider = 'google' | 'apple';
|
|
434
|
+
interface LinkedAccount {
|
|
435
|
+
provider: LinkedAccountProvider;
|
|
436
|
+
email: string | null;
|
|
437
|
+
connected_at: string;
|
|
438
|
+
}
|
|
439
|
+
|
|
374
440
|
interface MitumbaClientConfig {
|
|
375
441
|
baseUrl: string;
|
|
376
442
|
debug?: boolean;
|
|
@@ -444,10 +510,10 @@ declare class AuthModule {
|
|
|
444
510
|
register(input: RegisterInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse>;
|
|
445
511
|
/**
|
|
446
512
|
* Log in to an existing account.
|
|
447
|
-
* If using EmailLoginInput, returns AuthTokens.
|
|
513
|
+
* If using EmailLoginInput, returns AuthTokens (or TwoFactorRequired if 2FA enabled).
|
|
448
514
|
* If using PhoneLoginInput, returns MessageResponse (OTP sent).
|
|
449
515
|
*/
|
|
450
|
-
login(input: LoginInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse>;
|
|
516
|
+
login(input: LoginInput, options?: RequestOptions): Promise<AuthTokens | MessageResponse | TwoFactorRequired>;
|
|
451
517
|
/**
|
|
452
518
|
* Send an OTP code to a phone number.
|
|
453
519
|
*/
|
|
@@ -489,6 +555,10 @@ declare class AuthModule {
|
|
|
489
555
|
completeOnboarding(input: CompleteOnboardingInput, options?: RequestOptions): Promise<{
|
|
490
556
|
ok: true;
|
|
491
557
|
}>;
|
|
558
|
+
/**
|
|
559
|
+
* Verify 2FA code during login (when login returns requires_2fa).
|
|
560
|
+
*/
|
|
561
|
+
verify2FA(input: Verify2FAInput, options?: RequestOptions): Promise<AuthTokens>;
|
|
492
562
|
}
|
|
493
563
|
|
|
494
564
|
declare class ListingsModule {
|
|
@@ -827,6 +897,83 @@ declare class CartModule {
|
|
|
827
897
|
}>;
|
|
828
898
|
}
|
|
829
899
|
|
|
900
|
+
declare class SettingsModule {
|
|
901
|
+
private readonly client;
|
|
902
|
+
constructor(client: APIClient);
|
|
903
|
+
getProfile(options?: RequestOptions): Promise<UserProfile>;
|
|
904
|
+
updateProfile(input: UpdateProfileInput, options?: RequestOptions): Promise<{
|
|
905
|
+
ok: true;
|
|
906
|
+
}>;
|
|
907
|
+
changePassword(input: ChangePasswordInput, options?: RequestOptions): Promise<{
|
|
908
|
+
ok: true;
|
|
909
|
+
}>;
|
|
910
|
+
getSessions(options?: RequestOptions): Promise<{
|
|
911
|
+
data: Session[];
|
|
912
|
+
}>;
|
|
913
|
+
revokeSession(sessionId: string, options?: RequestOptions): Promise<{
|
|
914
|
+
ok: true;
|
|
915
|
+
}>;
|
|
916
|
+
getNotificationPrefs(options?: RequestOptions): Promise<{
|
|
917
|
+
data: NotificationPref[];
|
|
918
|
+
}>;
|
|
919
|
+
updateNotificationPref(channel: string, enabled: boolean, options?: RequestOptions): Promise<{
|
|
920
|
+
ok: true;
|
|
921
|
+
}>;
|
|
922
|
+
getPreferences(options?: RequestOptions): Promise<{
|
|
923
|
+
data: Record<string, string>;
|
|
924
|
+
}>;
|
|
925
|
+
updatePreferences(prefs: Record<string, string>, options?: RequestOptions): Promise<{
|
|
926
|
+
ok: true;
|
|
927
|
+
}>;
|
|
928
|
+
getAddresses(options?: RequestOptions): Promise<{
|
|
929
|
+
data: Address[];
|
|
930
|
+
}>;
|
|
931
|
+
addAddress(input: AddAddressInput, options?: RequestOptions): Promise<{
|
|
932
|
+
id: string;
|
|
933
|
+
}>;
|
|
934
|
+
updateAddress(id: string, input: Partial<AddAddressInput>, options?: RequestOptions): Promise<{
|
|
935
|
+
ok: true;
|
|
936
|
+
}>;
|
|
937
|
+
deleteAddress(id: string, options?: RequestOptions): Promise<{
|
|
938
|
+
ok: true;
|
|
939
|
+
}>;
|
|
940
|
+
setDefaultAddress(id: string, options?: RequestOptions): Promise<{
|
|
941
|
+
ok: true;
|
|
942
|
+
}>;
|
|
943
|
+
getPaymentMethods(options?: RequestOptions): Promise<{
|
|
944
|
+
data: PaymentMethod[];
|
|
945
|
+
}>;
|
|
946
|
+
addPaymentMethod(input: AddPaymentMethodInput, options?: RequestOptions): Promise<{
|
|
947
|
+
id: string;
|
|
948
|
+
}>;
|
|
949
|
+
deletePaymentMethod(id: string, options?: RequestOptions): Promise<{
|
|
950
|
+
ok: true;
|
|
951
|
+
}>;
|
|
952
|
+
setDefaultPaymentMethod(id: string, options?: RequestOptions): Promise<{
|
|
953
|
+
ok: true;
|
|
954
|
+
}>;
|
|
955
|
+
getLinkedAccounts(options?: RequestOptions): Promise<{
|
|
956
|
+
data: LinkedAccount[];
|
|
957
|
+
}>;
|
|
958
|
+
linkAccount(provider: LinkedAccountProvider, token: string, options?: RequestOptions): Promise<{
|
|
959
|
+
ok: true;
|
|
960
|
+
}>;
|
|
961
|
+
unlinkAccount(provider: LinkedAccountProvider, options?: RequestOptions): Promise<{
|
|
962
|
+
ok: true;
|
|
963
|
+
}>;
|
|
964
|
+
setup2FA(options?: RequestOptions): Promise<{
|
|
965
|
+
secret: string;
|
|
966
|
+
otpauth_uri: string;
|
|
967
|
+
}>;
|
|
968
|
+
verify2FA(code: string, options?: RequestOptions): Promise<{
|
|
969
|
+
ok: true;
|
|
970
|
+
backup_codes: string[];
|
|
971
|
+
}>;
|
|
972
|
+
disable2FA(code: string, options?: RequestOptions): Promise<{
|
|
973
|
+
ok: true;
|
|
974
|
+
}>;
|
|
975
|
+
}
|
|
976
|
+
|
|
830
977
|
declare class MitumbaClient {
|
|
831
978
|
readonly api: APIClient;
|
|
832
979
|
readonly auth: AuthModule;
|
|
@@ -841,6 +988,7 @@ declare class MitumbaClient {
|
|
|
841
988
|
readonly reviews: ReviewsModule;
|
|
842
989
|
readonly wishlists: WishlistsModule;
|
|
843
990
|
readonly cart: CartModule;
|
|
991
|
+
readonly settings: SettingsModule;
|
|
844
992
|
constructor(config: MitumbaClientConfig);
|
|
845
993
|
/**
|
|
846
994
|
* Set the access token for authenticated requests.
|
|
@@ -857,4 +1005,4 @@ declare class MitumbaClient {
|
|
|
857
1005
|
clearToken(): void;
|
|
858
1006
|
}
|
|
859
1007
|
|
|
860
|
-
export { APIClient, APIError, type APIErrorResponse, AuthModule, type AuthTokens, CONDITIONS, type CartItem, CartModule, type Category, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type EmailLoginInput, type EmailRegisterInput, type ForgotPasswordInput, GARMENT_TYPES, type GarmentType, LISTING_STATUSES, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationType, NotificationsModule, ORDER_STATUSES, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type RegisterInput, type RequestOptions, type ResetPasswordInput, type Review, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendMessageInput, type SendOtpInput, type SimilarListing, type StkPushInput, type StkPushResponse, type Store, StoresModule, type SubscriptionTier, type TransitionOrderInput, type TrendingTerm, type UpdateListingInput, type UserProfile, type VAZIOutfit, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type VerifyOtpInput, type WishlistListing, WishlistsModule };
|
|
1008
|
+
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AuthModule, type AuthTokens, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type EmailLoginInput, type EmailRegisterInput, type ForgotPasswordInput, GARMENT_TYPES, type GarmentType, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, 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 RegisterInput, type RequestOptions, type ResetPasswordInput, type Review, ReviewsModule, type SaveSearchInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StkPushInput, type StkPushResponse, type Store, StoresModule, type SubscriptionTier, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateListingInput, type UpdateProfileInput, type UserProfile, type VAZIOutfit, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule };
|
package/dist/index.js
CHANGED
|
@@ -175,7 +175,7 @@ var AuthModule = class {
|
|
|
175
175
|
}
|
|
176
176
|
/**
|
|
177
177
|
* Log in to an existing account.
|
|
178
|
-
* If using EmailLoginInput, returns AuthTokens.
|
|
178
|
+
* If using EmailLoginInput, returns AuthTokens (or TwoFactorRequired if 2FA enabled).
|
|
179
179
|
* If using PhoneLoginInput, returns MessageResponse (OTP sent).
|
|
180
180
|
*/
|
|
181
181
|
async login(input, options) {
|
|
@@ -230,6 +230,12 @@ var AuthModule = class {
|
|
|
230
230
|
async completeOnboarding(input, options) {
|
|
231
231
|
return this.client.post("/auth/onboarding/complete", input, options);
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Verify 2FA code during login (when login returns requires_2fa).
|
|
235
|
+
*/
|
|
236
|
+
async verify2FA(input, options) {
|
|
237
|
+
return this.client.post("/auth/2fa/login", input, options);
|
|
238
|
+
}
|
|
233
239
|
};
|
|
234
240
|
|
|
235
241
|
// src/modules/listings.ts
|
|
@@ -653,6 +659,94 @@ var CartModule = class {
|
|
|
653
659
|
}
|
|
654
660
|
};
|
|
655
661
|
|
|
662
|
+
// src/modules/settings.ts
|
|
663
|
+
var SettingsModule = class {
|
|
664
|
+
constructor(client) {
|
|
665
|
+
this.client = client;
|
|
666
|
+
}
|
|
667
|
+
client;
|
|
668
|
+
// ── Profile ──
|
|
669
|
+
async getProfile(options) {
|
|
670
|
+
return this.client.get("/auth/me", void 0, options);
|
|
671
|
+
}
|
|
672
|
+
async updateProfile(input, options) {
|
|
673
|
+
return this.client.put("/auth/me", input, options);
|
|
674
|
+
}
|
|
675
|
+
// ── Security ──
|
|
676
|
+
async changePassword(input, options) {
|
|
677
|
+
return this.client.post("/auth/change-password", input, options);
|
|
678
|
+
}
|
|
679
|
+
async getSessions(options) {
|
|
680
|
+
return this.client.get("/auth/sessions", void 0, options);
|
|
681
|
+
}
|
|
682
|
+
async revokeSession(sessionId, options) {
|
|
683
|
+
return this.client.delete(`/auth/sessions/${sessionId}`, options);
|
|
684
|
+
}
|
|
685
|
+
// ── Notification Preferences ──
|
|
686
|
+
async getNotificationPrefs(options) {
|
|
687
|
+
return this.client.get("/auth/notification-prefs", void 0, options);
|
|
688
|
+
}
|
|
689
|
+
async updateNotificationPref(channel, enabled, options) {
|
|
690
|
+
return this.client.put(`/auth/notification-prefs/${channel}`, { enabled }, options);
|
|
691
|
+
}
|
|
692
|
+
// ── Preferences ──
|
|
693
|
+
async getPreferences(options) {
|
|
694
|
+
return this.client.get("/auth/preferences", void 0, options);
|
|
695
|
+
}
|
|
696
|
+
async updatePreferences(prefs, options) {
|
|
697
|
+
return this.client.put("/auth/preferences", { prefs }, options);
|
|
698
|
+
}
|
|
699
|
+
// ── Addresses ──
|
|
700
|
+
async getAddresses(options) {
|
|
701
|
+
return this.client.get("/auth/addresses", void 0, options);
|
|
702
|
+
}
|
|
703
|
+
async addAddress(input, options) {
|
|
704
|
+
return this.client.post("/auth/addresses", input, options);
|
|
705
|
+
}
|
|
706
|
+
async updateAddress(id, input, options) {
|
|
707
|
+
return this.client.put(`/auth/addresses/${id}`, input, options);
|
|
708
|
+
}
|
|
709
|
+
async deleteAddress(id, options) {
|
|
710
|
+
return this.client.delete(`/auth/addresses/${id}`, options);
|
|
711
|
+
}
|
|
712
|
+
async setDefaultAddress(id, options) {
|
|
713
|
+
return this.client.post(`/auth/addresses/${id}/default`, void 0, options);
|
|
714
|
+
}
|
|
715
|
+
// ── Payment Methods ──
|
|
716
|
+
async getPaymentMethods(options) {
|
|
717
|
+
return this.client.get("/auth/payment-methods", void 0, options);
|
|
718
|
+
}
|
|
719
|
+
async addPaymentMethod(input, options) {
|
|
720
|
+
return this.client.post("/auth/payment-methods", input, options);
|
|
721
|
+
}
|
|
722
|
+
async deletePaymentMethod(id, options) {
|
|
723
|
+
return this.client.delete(`/auth/payment-methods/${id}`, options);
|
|
724
|
+
}
|
|
725
|
+
async setDefaultPaymentMethod(id, options) {
|
|
726
|
+
return this.client.post(`/auth/payment-methods/${id}/default`, void 0, options);
|
|
727
|
+
}
|
|
728
|
+
// ── Linked Accounts ──
|
|
729
|
+
async getLinkedAccounts(options) {
|
|
730
|
+
return this.client.get("/auth/linked-accounts", void 0, options);
|
|
731
|
+
}
|
|
732
|
+
async linkAccount(provider, token, options) {
|
|
733
|
+
return this.client.post("/auth/linked-accounts", { provider, token }, options);
|
|
734
|
+
}
|
|
735
|
+
async unlinkAccount(provider, options) {
|
|
736
|
+
return this.client.delete(`/auth/linked-accounts/${provider}`, options);
|
|
737
|
+
}
|
|
738
|
+
// ── 2FA ──
|
|
739
|
+
async setup2FA(options) {
|
|
740
|
+
return this.client.post("/auth/2fa/setup", void 0, options);
|
|
741
|
+
}
|
|
742
|
+
async verify2FA(code, options) {
|
|
743
|
+
return this.client.post("/auth/2fa/verify", { code }, options);
|
|
744
|
+
}
|
|
745
|
+
async disable2FA(code, options) {
|
|
746
|
+
return this.client.post("/auth/2fa/disable", { code }, options);
|
|
747
|
+
}
|
|
748
|
+
};
|
|
749
|
+
|
|
656
750
|
// src/types/listings.ts
|
|
657
751
|
var CONDITIONS = ["new", "like_new", "good", "fair"];
|
|
658
752
|
var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
|
|
@@ -700,6 +794,7 @@ var MitumbaClient = class {
|
|
|
700
794
|
reviews;
|
|
701
795
|
wishlists;
|
|
702
796
|
cart;
|
|
797
|
+
settings;
|
|
703
798
|
constructor(config) {
|
|
704
799
|
this.api = new APIClient(config);
|
|
705
800
|
this.auth = new AuthModule(this.api);
|
|
@@ -714,6 +809,7 @@ var MitumbaClient = class {
|
|
|
714
809
|
this.reviews = new ReviewsModule(this.api);
|
|
715
810
|
this.wishlists = new WishlistsModule(this.api);
|
|
716
811
|
this.cart = new CartModule(this.api);
|
|
812
|
+
this.settings = new SettingsModule(this.api);
|
|
717
813
|
}
|
|
718
814
|
/**
|
|
719
815
|
* Set the access token for authenticated requests.
|
|
@@ -753,6 +849,7 @@ exports.PAYMENT_STATUSES = PAYMENT_STATUSES;
|
|
|
753
849
|
exports.PayModule = PayModule;
|
|
754
850
|
exports.ReviewsModule = ReviewsModule;
|
|
755
851
|
exports.SearchModule = SearchModule;
|
|
852
|
+
exports.SettingsModule = SettingsModule;
|
|
756
853
|
exports.StoresModule = StoresModule;
|
|
757
854
|
exports.VaziModule = VaziModule;
|
|
758
855
|
exports.WishlistsModule = WishlistsModule;
|