@mitumba/sdk 1.12.0 → 1.14.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 +168 -1
- package/dist/index.d.ts +168 -1
- package/dist/index.js +102 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +98 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -654,6 +654,84 @@ interface UpdateBusinessInput {
|
|
|
654
654
|
price_range_max?: number;
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
+
interface BlockedIp {
|
|
658
|
+
ip: string;
|
|
659
|
+
blocked_at: string;
|
|
660
|
+
expires_at: string;
|
|
661
|
+
}
|
|
662
|
+
interface SystemStats {
|
|
663
|
+
total_users: number;
|
|
664
|
+
total_sellers: number;
|
|
665
|
+
total_listings: number;
|
|
666
|
+
total_orders: number;
|
|
667
|
+
total_revenue: number;
|
|
668
|
+
active_today: number;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
declare const DISPUTE_REASONS: readonly ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
|
|
672
|
+
type DisputeReason = typeof DISPUTE_REASONS[number];
|
|
673
|
+
declare const DESIRED_RESOLUTIONS: readonly ["refund", "replacement", "partial_refund"];
|
|
674
|
+
type DesiredResolution = typeof DESIRED_RESOLUTIONS[number];
|
|
675
|
+
declare const DISPUTE_STATUSES: readonly ["open", "seller_responded", "under_review", "resolved_refund", "resolved_release", "resolved_partial", "withdrawn"];
|
|
676
|
+
type DisputeStatus = typeof DISPUTE_STATUSES[number];
|
|
677
|
+
interface DisputeEvidence {
|
|
678
|
+
id: string;
|
|
679
|
+
uploader_role: 'buyer' | 'seller' | 'admin';
|
|
680
|
+
type: 'image' | 'text';
|
|
681
|
+
content: string;
|
|
682
|
+
created_at: string;
|
|
683
|
+
}
|
|
684
|
+
interface DisputeEvent {
|
|
685
|
+
actor_role: 'buyer' | 'seller' | 'admin' | 'system';
|
|
686
|
+
action: string;
|
|
687
|
+
old_status: string | null;
|
|
688
|
+
new_status: string | null;
|
|
689
|
+
note: string | null;
|
|
690
|
+
created_at: string;
|
|
691
|
+
}
|
|
692
|
+
interface Dispute {
|
|
693
|
+
id: string;
|
|
694
|
+
order_id: string;
|
|
695
|
+
buyer_id: string;
|
|
696
|
+
seller_id: string;
|
|
697
|
+
reason: DisputeReason;
|
|
698
|
+
description: string;
|
|
699
|
+
desired_resolution: DesiredResolution;
|
|
700
|
+
status: DisputeStatus;
|
|
701
|
+
amount_disputed: number;
|
|
702
|
+
resolution: 'refund' | 'release' | 'partial' | null;
|
|
703
|
+
resolution_amount: number | null;
|
|
704
|
+
resolution_note: string | null;
|
|
705
|
+
sti_impact: number | null;
|
|
706
|
+
seller_responded_at: string | null;
|
|
707
|
+
escalated_at: string | null;
|
|
708
|
+
resolved_at: string | null;
|
|
709
|
+
created_at: string;
|
|
710
|
+
updated_at: string;
|
|
711
|
+
evidence?: DisputeEvidence[];
|
|
712
|
+
events?: DisputeEvent[];
|
|
713
|
+
}
|
|
714
|
+
interface RaiseDisputeInput {
|
|
715
|
+
reason: DisputeReason;
|
|
716
|
+
description: string;
|
|
717
|
+
desired_resolution: DesiredResolution;
|
|
718
|
+
evidence_urls?: string[];
|
|
719
|
+
}
|
|
720
|
+
interface RespondDisputeInput {
|
|
721
|
+
accept: boolean;
|
|
722
|
+
message?: string;
|
|
723
|
+
evidence_urls?: string[];
|
|
724
|
+
}
|
|
725
|
+
interface ResolveDisputeInput {
|
|
726
|
+
resolution: 'refund' | 'release' | 'partial';
|
|
727
|
+
amount?: number;
|
|
728
|
+
note?: string;
|
|
729
|
+
}
|
|
730
|
+
interface DisputeListParams {
|
|
731
|
+
status?: DisputeStatus;
|
|
732
|
+
page?: number;
|
|
733
|
+
}
|
|
734
|
+
|
|
657
735
|
interface MitumbaClientConfig {
|
|
658
736
|
baseUrl: string;
|
|
659
737
|
debug?: boolean;
|
|
@@ -1365,6 +1443,93 @@ declare class BusinessesModule {
|
|
|
1365
1443
|
}>;
|
|
1366
1444
|
}
|
|
1367
1445
|
|
|
1446
|
+
declare class AdminModule {
|
|
1447
|
+
private readonly client;
|
|
1448
|
+
constructor(client: APIClient);
|
|
1449
|
+
/** Block an IP address. Default duration: 24 hours. */
|
|
1450
|
+
blockIp(ip: string, durationHours?: number, options?: RequestOptions): Promise<{
|
|
1451
|
+
ok: true;
|
|
1452
|
+
blocked: string;
|
|
1453
|
+
hours: number;
|
|
1454
|
+
}>;
|
|
1455
|
+
/** Unblock an IP address. */
|
|
1456
|
+
unblockIp(ip: string, options?: RequestOptions): Promise<{
|
|
1457
|
+
ok: true;
|
|
1458
|
+
unblocked: string;
|
|
1459
|
+
}>;
|
|
1460
|
+
/** List currently blocked IPs. */
|
|
1461
|
+
getBlockedIps(options?: RequestOptions): Promise<{
|
|
1462
|
+
data: BlockedIp[];
|
|
1463
|
+
}>;
|
|
1464
|
+
/** Get platform-wide statistics. */
|
|
1465
|
+
getSystemStats(options?: RequestOptions): Promise<SystemStats>;
|
|
1466
|
+
/** Suspend a user account. */
|
|
1467
|
+
suspendUser(userId: string, reason: string, options?: RequestOptions): Promise<{
|
|
1468
|
+
ok: true;
|
|
1469
|
+
}>;
|
|
1470
|
+
/** Unsuspend a user account. */
|
|
1471
|
+
unsuspendUser(userId: string, options?: RequestOptions): Promise<{
|
|
1472
|
+
ok: true;
|
|
1473
|
+
}>;
|
|
1474
|
+
/** Grant verified badge to a store. */
|
|
1475
|
+
verifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1476
|
+
ok: true;
|
|
1477
|
+
}>;
|
|
1478
|
+
/** Revoke verified badge from a store. */
|
|
1479
|
+
unverifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1480
|
+
ok: true;
|
|
1481
|
+
}>;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
declare class DisputesModule {
|
|
1485
|
+
private readonly client;
|
|
1486
|
+
constructor(client: APIClient);
|
|
1487
|
+
/** Raise a dispute on an order (buyer). */
|
|
1488
|
+
raise(orderId: string, input: RaiseDisputeInput, options?: RequestOptions): Promise<{
|
|
1489
|
+
dispute_id: string;
|
|
1490
|
+
status: 'open';
|
|
1491
|
+
}>;
|
|
1492
|
+
/** Get the dispute for a specific order. */
|
|
1493
|
+
getForOrder(orderId: string, options?: RequestOptions): Promise<Dispute>;
|
|
1494
|
+
/** Get a dispute by ID. */
|
|
1495
|
+
get(disputeId: string, options?: RequestOptions): Promise<Dispute>;
|
|
1496
|
+
/** Add evidence to a dispute. */
|
|
1497
|
+
addEvidence(disputeId: string, input: {
|
|
1498
|
+
type: 'image' | 'text';
|
|
1499
|
+
content: string;
|
|
1500
|
+
}, options?: RequestOptions): Promise<{
|
|
1501
|
+
ok: true;
|
|
1502
|
+
}>;
|
|
1503
|
+
/** Escalate a dispute to admin review (buyer). */
|
|
1504
|
+
escalate(disputeId: string, options?: RequestOptions): Promise<{
|
|
1505
|
+
ok: true;
|
|
1506
|
+
status: 'under_review';
|
|
1507
|
+
}>;
|
|
1508
|
+
/** Withdraw a dispute (buyer). */
|
|
1509
|
+
withdraw(disputeId: string, options?: RequestOptions): Promise<{
|
|
1510
|
+
ok: true;
|
|
1511
|
+
status: 'withdrawn';
|
|
1512
|
+
}>;
|
|
1513
|
+
/** Respond to a dispute (seller). */
|
|
1514
|
+
respond(disputeId: string, input: RespondDisputeInput, options?: RequestOptions): Promise<{
|
|
1515
|
+
ok: true;
|
|
1516
|
+
status?: string;
|
|
1517
|
+
voluntary?: boolean;
|
|
1518
|
+
}>;
|
|
1519
|
+
/** List all disputes (admin). */
|
|
1520
|
+
list(params?: DisputeListParams, options?: RequestOptions): Promise<{
|
|
1521
|
+
data: Dispute[];
|
|
1522
|
+
page: number;
|
|
1523
|
+
page_size: number;
|
|
1524
|
+
}>;
|
|
1525
|
+
/** Resolve a dispute (admin). */
|
|
1526
|
+
resolve(disputeId: string, input: ResolveDisputeInput, options?: RequestOptions): Promise<{
|
|
1527
|
+
ok: true;
|
|
1528
|
+
status: string;
|
|
1529
|
+
sti_impact: number;
|
|
1530
|
+
}>;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1368
1533
|
declare class MitumbaClient {
|
|
1369
1534
|
readonly api: APIClient;
|
|
1370
1535
|
readonly auth: AuthModule;
|
|
@@ -1382,6 +1547,8 @@ declare class MitumbaClient {
|
|
|
1382
1547
|
readonly settings: SettingsModule;
|
|
1383
1548
|
readonly mailer: MailerModule;
|
|
1384
1549
|
readonly businesses: BusinessesModule;
|
|
1550
|
+
readonly admin: AdminModule;
|
|
1551
|
+
readonly disputes: DisputesModule;
|
|
1385
1552
|
constructor(config: MitumbaClientConfig);
|
|
1386
1553
|
/**
|
|
1387
1554
|
* Set the access token for authenticated requests.
|
|
@@ -1406,4 +1573,4 @@ declare class MitumbaClient {
|
|
|
1406
1573
|
isAuthenticated(): Promise<boolean>;
|
|
1407
1574
|
}
|
|
1408
1575
|
|
|
1409
|
-
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AuthModule, type AuthTokens, type BecomeSellerInput, type Business, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type CreateStoreInput, type DeliveryAddress, type EmailLoginInput, type EmailRegisterInput, 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 RegisterInput, type RequestOptions, type ResetPasswordInput, 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 StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
|
|
1576
|
+
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AdminModule, 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 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 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, 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 StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
|
package/dist/index.d.ts
CHANGED
|
@@ -654,6 +654,84 @@ interface UpdateBusinessInput {
|
|
|
654
654
|
price_range_max?: number;
|
|
655
655
|
}
|
|
656
656
|
|
|
657
|
+
interface BlockedIp {
|
|
658
|
+
ip: string;
|
|
659
|
+
blocked_at: string;
|
|
660
|
+
expires_at: string;
|
|
661
|
+
}
|
|
662
|
+
interface SystemStats {
|
|
663
|
+
total_users: number;
|
|
664
|
+
total_sellers: number;
|
|
665
|
+
total_listings: number;
|
|
666
|
+
total_orders: number;
|
|
667
|
+
total_revenue: number;
|
|
668
|
+
active_today: number;
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
declare const DISPUTE_REASONS: readonly ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
|
|
672
|
+
type DisputeReason = typeof DISPUTE_REASONS[number];
|
|
673
|
+
declare const DESIRED_RESOLUTIONS: readonly ["refund", "replacement", "partial_refund"];
|
|
674
|
+
type DesiredResolution = typeof DESIRED_RESOLUTIONS[number];
|
|
675
|
+
declare const DISPUTE_STATUSES: readonly ["open", "seller_responded", "under_review", "resolved_refund", "resolved_release", "resolved_partial", "withdrawn"];
|
|
676
|
+
type DisputeStatus = typeof DISPUTE_STATUSES[number];
|
|
677
|
+
interface DisputeEvidence {
|
|
678
|
+
id: string;
|
|
679
|
+
uploader_role: 'buyer' | 'seller' | 'admin';
|
|
680
|
+
type: 'image' | 'text';
|
|
681
|
+
content: string;
|
|
682
|
+
created_at: string;
|
|
683
|
+
}
|
|
684
|
+
interface DisputeEvent {
|
|
685
|
+
actor_role: 'buyer' | 'seller' | 'admin' | 'system';
|
|
686
|
+
action: string;
|
|
687
|
+
old_status: string | null;
|
|
688
|
+
new_status: string | null;
|
|
689
|
+
note: string | null;
|
|
690
|
+
created_at: string;
|
|
691
|
+
}
|
|
692
|
+
interface Dispute {
|
|
693
|
+
id: string;
|
|
694
|
+
order_id: string;
|
|
695
|
+
buyer_id: string;
|
|
696
|
+
seller_id: string;
|
|
697
|
+
reason: DisputeReason;
|
|
698
|
+
description: string;
|
|
699
|
+
desired_resolution: DesiredResolution;
|
|
700
|
+
status: DisputeStatus;
|
|
701
|
+
amount_disputed: number;
|
|
702
|
+
resolution: 'refund' | 'release' | 'partial' | null;
|
|
703
|
+
resolution_amount: number | null;
|
|
704
|
+
resolution_note: string | null;
|
|
705
|
+
sti_impact: number | null;
|
|
706
|
+
seller_responded_at: string | null;
|
|
707
|
+
escalated_at: string | null;
|
|
708
|
+
resolved_at: string | null;
|
|
709
|
+
created_at: string;
|
|
710
|
+
updated_at: string;
|
|
711
|
+
evidence?: DisputeEvidence[];
|
|
712
|
+
events?: DisputeEvent[];
|
|
713
|
+
}
|
|
714
|
+
interface RaiseDisputeInput {
|
|
715
|
+
reason: DisputeReason;
|
|
716
|
+
description: string;
|
|
717
|
+
desired_resolution: DesiredResolution;
|
|
718
|
+
evidence_urls?: string[];
|
|
719
|
+
}
|
|
720
|
+
interface RespondDisputeInput {
|
|
721
|
+
accept: boolean;
|
|
722
|
+
message?: string;
|
|
723
|
+
evidence_urls?: string[];
|
|
724
|
+
}
|
|
725
|
+
interface ResolveDisputeInput {
|
|
726
|
+
resolution: 'refund' | 'release' | 'partial';
|
|
727
|
+
amount?: number;
|
|
728
|
+
note?: string;
|
|
729
|
+
}
|
|
730
|
+
interface DisputeListParams {
|
|
731
|
+
status?: DisputeStatus;
|
|
732
|
+
page?: number;
|
|
733
|
+
}
|
|
734
|
+
|
|
657
735
|
interface MitumbaClientConfig {
|
|
658
736
|
baseUrl: string;
|
|
659
737
|
debug?: boolean;
|
|
@@ -1365,6 +1443,93 @@ declare class BusinessesModule {
|
|
|
1365
1443
|
}>;
|
|
1366
1444
|
}
|
|
1367
1445
|
|
|
1446
|
+
declare class AdminModule {
|
|
1447
|
+
private readonly client;
|
|
1448
|
+
constructor(client: APIClient);
|
|
1449
|
+
/** Block an IP address. Default duration: 24 hours. */
|
|
1450
|
+
blockIp(ip: string, durationHours?: number, options?: RequestOptions): Promise<{
|
|
1451
|
+
ok: true;
|
|
1452
|
+
blocked: string;
|
|
1453
|
+
hours: number;
|
|
1454
|
+
}>;
|
|
1455
|
+
/** Unblock an IP address. */
|
|
1456
|
+
unblockIp(ip: string, options?: RequestOptions): Promise<{
|
|
1457
|
+
ok: true;
|
|
1458
|
+
unblocked: string;
|
|
1459
|
+
}>;
|
|
1460
|
+
/** List currently blocked IPs. */
|
|
1461
|
+
getBlockedIps(options?: RequestOptions): Promise<{
|
|
1462
|
+
data: BlockedIp[];
|
|
1463
|
+
}>;
|
|
1464
|
+
/** Get platform-wide statistics. */
|
|
1465
|
+
getSystemStats(options?: RequestOptions): Promise<SystemStats>;
|
|
1466
|
+
/** Suspend a user account. */
|
|
1467
|
+
suspendUser(userId: string, reason: string, options?: RequestOptions): Promise<{
|
|
1468
|
+
ok: true;
|
|
1469
|
+
}>;
|
|
1470
|
+
/** Unsuspend a user account. */
|
|
1471
|
+
unsuspendUser(userId: string, options?: RequestOptions): Promise<{
|
|
1472
|
+
ok: true;
|
|
1473
|
+
}>;
|
|
1474
|
+
/** Grant verified badge to a store. */
|
|
1475
|
+
verifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1476
|
+
ok: true;
|
|
1477
|
+
}>;
|
|
1478
|
+
/** Revoke verified badge from a store. */
|
|
1479
|
+
unverifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1480
|
+
ok: true;
|
|
1481
|
+
}>;
|
|
1482
|
+
}
|
|
1483
|
+
|
|
1484
|
+
declare class DisputesModule {
|
|
1485
|
+
private readonly client;
|
|
1486
|
+
constructor(client: APIClient);
|
|
1487
|
+
/** Raise a dispute on an order (buyer). */
|
|
1488
|
+
raise(orderId: string, input: RaiseDisputeInput, options?: RequestOptions): Promise<{
|
|
1489
|
+
dispute_id: string;
|
|
1490
|
+
status: 'open';
|
|
1491
|
+
}>;
|
|
1492
|
+
/** Get the dispute for a specific order. */
|
|
1493
|
+
getForOrder(orderId: string, options?: RequestOptions): Promise<Dispute>;
|
|
1494
|
+
/** Get a dispute by ID. */
|
|
1495
|
+
get(disputeId: string, options?: RequestOptions): Promise<Dispute>;
|
|
1496
|
+
/** Add evidence to a dispute. */
|
|
1497
|
+
addEvidence(disputeId: string, input: {
|
|
1498
|
+
type: 'image' | 'text';
|
|
1499
|
+
content: string;
|
|
1500
|
+
}, options?: RequestOptions): Promise<{
|
|
1501
|
+
ok: true;
|
|
1502
|
+
}>;
|
|
1503
|
+
/** Escalate a dispute to admin review (buyer). */
|
|
1504
|
+
escalate(disputeId: string, options?: RequestOptions): Promise<{
|
|
1505
|
+
ok: true;
|
|
1506
|
+
status: 'under_review';
|
|
1507
|
+
}>;
|
|
1508
|
+
/** Withdraw a dispute (buyer). */
|
|
1509
|
+
withdraw(disputeId: string, options?: RequestOptions): Promise<{
|
|
1510
|
+
ok: true;
|
|
1511
|
+
status: 'withdrawn';
|
|
1512
|
+
}>;
|
|
1513
|
+
/** Respond to a dispute (seller). */
|
|
1514
|
+
respond(disputeId: string, input: RespondDisputeInput, options?: RequestOptions): Promise<{
|
|
1515
|
+
ok: true;
|
|
1516
|
+
status?: string;
|
|
1517
|
+
voluntary?: boolean;
|
|
1518
|
+
}>;
|
|
1519
|
+
/** List all disputes (admin). */
|
|
1520
|
+
list(params?: DisputeListParams, options?: RequestOptions): Promise<{
|
|
1521
|
+
data: Dispute[];
|
|
1522
|
+
page: number;
|
|
1523
|
+
page_size: number;
|
|
1524
|
+
}>;
|
|
1525
|
+
/** Resolve a dispute (admin). */
|
|
1526
|
+
resolve(disputeId: string, input: ResolveDisputeInput, options?: RequestOptions): Promise<{
|
|
1527
|
+
ok: true;
|
|
1528
|
+
status: string;
|
|
1529
|
+
sti_impact: number;
|
|
1530
|
+
}>;
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1368
1533
|
declare class MitumbaClient {
|
|
1369
1534
|
readonly api: APIClient;
|
|
1370
1535
|
readonly auth: AuthModule;
|
|
@@ -1382,6 +1547,8 @@ declare class MitumbaClient {
|
|
|
1382
1547
|
readonly settings: SettingsModule;
|
|
1383
1548
|
readonly mailer: MailerModule;
|
|
1384
1549
|
readonly businesses: BusinessesModule;
|
|
1550
|
+
readonly admin: AdminModule;
|
|
1551
|
+
readonly disputes: DisputesModule;
|
|
1385
1552
|
constructor(config: MitumbaClientConfig);
|
|
1386
1553
|
/**
|
|
1387
1554
|
* Set the access token for authenticated requests.
|
|
@@ -1406,4 +1573,4 @@ declare class MitumbaClient {
|
|
|
1406
1573
|
isAuthenticated(): Promise<boolean>;
|
|
1407
1574
|
}
|
|
1408
1575
|
|
|
1409
|
-
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AuthModule, type AuthTokens, type BecomeSellerInput, type Business, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type City, type CompleteOnboardingInput, type Condition, type Conversation, type CreateListingInput, type CreateOrderInput, type CreateReviewInput, type CreateStoreInput, type DeliveryAddress, type EmailLoginInput, type EmailRegisterInput, 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 RegisterInput, type RequestOptions, type ResetPasswordInput, 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 StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
|
|
1576
|
+
export { APIClient, APIError, type APIErrorResponse, type AddAddressInput, type AddPaymentMethodInput, type Address, AdminModule, 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 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 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, 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 StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
|
package/dist/index.js
CHANGED
|
@@ -1069,6 +1069,94 @@ var BusinessesModule = class {
|
|
|
1069
1069
|
}
|
|
1070
1070
|
};
|
|
1071
1071
|
|
|
1072
|
+
// src/modules/admin.ts
|
|
1073
|
+
var AdminModule = class {
|
|
1074
|
+
constructor(client) {
|
|
1075
|
+
this.client = client;
|
|
1076
|
+
}
|
|
1077
|
+
client;
|
|
1078
|
+
/** Block an IP address. Default duration: 24 hours. */
|
|
1079
|
+
async blockIp(ip, durationHours, options) {
|
|
1080
|
+
return this.client.post("/admin/block-ip", { ip, duration_hours: durationHours ?? 24 }, options);
|
|
1081
|
+
}
|
|
1082
|
+
/** Unblock an IP address. */
|
|
1083
|
+
async unblockIp(ip, options) {
|
|
1084
|
+
return this.client.post("/admin/unblock-ip", { ip }, options);
|
|
1085
|
+
}
|
|
1086
|
+
/** List currently blocked IPs. */
|
|
1087
|
+
async getBlockedIps(options) {
|
|
1088
|
+
return this.client.get("/admin/blocked-ips", void 0, options);
|
|
1089
|
+
}
|
|
1090
|
+
/** Get platform-wide statistics. */
|
|
1091
|
+
async getSystemStats(options) {
|
|
1092
|
+
return this.client.get("/admin/stats", void 0, options);
|
|
1093
|
+
}
|
|
1094
|
+
/** Suspend a user account. */
|
|
1095
|
+
async suspendUser(userId, reason, options) {
|
|
1096
|
+
return this.client.post(`/admin/users/${userId}/suspend`, { reason }, options);
|
|
1097
|
+
}
|
|
1098
|
+
/** Unsuspend a user account. */
|
|
1099
|
+
async unsuspendUser(userId, options) {
|
|
1100
|
+
return this.client.post(`/admin/users/${userId}/unsuspend`, void 0, options);
|
|
1101
|
+
}
|
|
1102
|
+
/** Grant verified badge to a store. */
|
|
1103
|
+
async verifyStore(storeId, options) {
|
|
1104
|
+
return this.client.post(`/admin/stores/${storeId}/verify`, void 0, options);
|
|
1105
|
+
}
|
|
1106
|
+
/** Revoke verified badge from a store. */
|
|
1107
|
+
async unverifyStore(storeId, options) {
|
|
1108
|
+
return this.client.post(`/admin/stores/${storeId}/unverify`, void 0, options);
|
|
1109
|
+
}
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
// src/modules/disputes.ts
|
|
1113
|
+
var DisputesModule = class {
|
|
1114
|
+
constructor(client) {
|
|
1115
|
+
this.client = client;
|
|
1116
|
+
}
|
|
1117
|
+
client;
|
|
1118
|
+
/** Raise a dispute on an order (buyer). */
|
|
1119
|
+
async raise(orderId, input, options) {
|
|
1120
|
+
return this.client.post(`/orders/${orderId}/dispute`, input, options);
|
|
1121
|
+
}
|
|
1122
|
+
/** Get the dispute for a specific order. */
|
|
1123
|
+
async getForOrder(orderId, options) {
|
|
1124
|
+
return this.client.get(`/orders/${orderId}/dispute`, void 0, options);
|
|
1125
|
+
}
|
|
1126
|
+
/** Get a dispute by ID. */
|
|
1127
|
+
async get(disputeId, options) {
|
|
1128
|
+
return this.client.get(`/orders/disputes/${disputeId}`, void 0, options);
|
|
1129
|
+
}
|
|
1130
|
+
/** Add evidence to a dispute. */
|
|
1131
|
+
async addEvidence(disputeId, input, options) {
|
|
1132
|
+
return this.client.post(`/orders/disputes/${disputeId}/evidence`, input, options);
|
|
1133
|
+
}
|
|
1134
|
+
/** Escalate a dispute to admin review (buyer). */
|
|
1135
|
+
async escalate(disputeId, options) {
|
|
1136
|
+
return this.client.post(`/orders/disputes/${disputeId}/escalate`, void 0, options);
|
|
1137
|
+
}
|
|
1138
|
+
/** Withdraw a dispute (buyer). */
|
|
1139
|
+
async withdraw(disputeId, options) {
|
|
1140
|
+
return this.client.post(`/orders/disputes/${disputeId}/withdraw`, void 0, options);
|
|
1141
|
+
}
|
|
1142
|
+
/** Respond to a dispute (seller). */
|
|
1143
|
+
async respond(disputeId, input, options) {
|
|
1144
|
+
return this.client.post(`/orders/disputes/${disputeId}/respond`, input, options);
|
|
1145
|
+
}
|
|
1146
|
+
/** List all disputes (admin). */
|
|
1147
|
+
async list(params, options) {
|
|
1148
|
+
return this.client.get(
|
|
1149
|
+
"/orders/disputes",
|
|
1150
|
+
params,
|
|
1151
|
+
options
|
|
1152
|
+
);
|
|
1153
|
+
}
|
|
1154
|
+
/** Resolve a dispute (admin). */
|
|
1155
|
+
async resolve(disputeId, input, options) {
|
|
1156
|
+
return this.client.post(`/orders/disputes/${disputeId}/resolve`, input, options);
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
|
|
1072
1160
|
// src/types/listings.ts
|
|
1073
1161
|
var CONDITIONS = ["new", "like_new", "good", "fair"];
|
|
1074
1162
|
var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
|
|
@@ -1089,6 +1177,11 @@ var ORDER_STATUSES = [
|
|
|
1089
1177
|
// src/types/pay.ts
|
|
1090
1178
|
var PAYMENT_STATUSES = ["initiated", "funded", "failed", "refunded", "cancelled"];
|
|
1091
1179
|
|
|
1180
|
+
// src/types/disputes.ts
|
|
1181
|
+
var DISPUTE_REASONS = ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
|
|
1182
|
+
var DESIRED_RESOLUTIONS = ["refund", "replacement", "partial_refund"];
|
|
1183
|
+
var DISPUTE_STATUSES = ["open", "seller_responded", "under_review", "resolved_refund", "resolved_release", "resolved_partial", "withdrawn"];
|
|
1184
|
+
|
|
1092
1185
|
// src/index.ts
|
|
1093
1186
|
var MitumbaClient = class {
|
|
1094
1187
|
api;
|
|
@@ -1107,6 +1200,8 @@ var MitumbaClient = class {
|
|
|
1107
1200
|
settings;
|
|
1108
1201
|
mailer;
|
|
1109
1202
|
businesses;
|
|
1203
|
+
admin;
|
|
1204
|
+
disputes;
|
|
1110
1205
|
constructor(config) {
|
|
1111
1206
|
this.api = new APIClient(config);
|
|
1112
1207
|
this.auth = new AuthModule(this.api);
|
|
@@ -1124,6 +1219,8 @@ var MitumbaClient = class {
|
|
|
1124
1219
|
this.settings = new SettingsModule(this.api);
|
|
1125
1220
|
this.mailer = new MailerModule(this.api);
|
|
1126
1221
|
this.businesses = new BusinessesModule(this.api);
|
|
1222
|
+
this.admin = new AdminModule(this.api);
|
|
1223
|
+
this.disputes = new DisputesModule(this.api);
|
|
1127
1224
|
}
|
|
1128
1225
|
/**
|
|
1129
1226
|
* Set the access token for authenticated requests.
|
|
@@ -1160,10 +1257,15 @@ var MitumbaClient = class {
|
|
|
1160
1257
|
|
|
1161
1258
|
exports.APIClient = APIClient;
|
|
1162
1259
|
exports.APIError = APIError;
|
|
1260
|
+
exports.AdminModule = AdminModule;
|
|
1163
1261
|
exports.AuthModule = AuthModule;
|
|
1164
1262
|
exports.BusinessesModule = BusinessesModule;
|
|
1165
1263
|
exports.CONDITIONS = CONDITIONS;
|
|
1166
1264
|
exports.CartModule = CartModule;
|
|
1265
|
+
exports.DESIRED_RESOLUTIONS = DESIRED_RESOLUTIONS;
|
|
1266
|
+
exports.DISPUTE_REASONS = DISPUTE_REASONS;
|
|
1267
|
+
exports.DISPUTE_STATUSES = DISPUTE_STATUSES;
|
|
1268
|
+
exports.DisputesModule = DisputesModule;
|
|
1167
1269
|
exports.IDBTokenStore = IDBTokenStore;
|
|
1168
1270
|
exports.LISTING_STATUSES = LISTING_STATUSES;
|
|
1169
1271
|
exports.ListingsModule = ListingsModule;
|