@mitumba/sdk 1.15.0 → 1.16.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 +344 -9
- package/dist/index.d.ts +344 -9
- package/dist/index.js +118 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -667,6 +667,167 @@ interface SystemStats {
|
|
|
667
667
|
total_revenue: number;
|
|
668
668
|
active_today: number;
|
|
669
669
|
}
|
|
670
|
+
interface AdminUserListItem {
|
|
671
|
+
id: string;
|
|
672
|
+
display_name: string | null;
|
|
673
|
+
email: string | null;
|
|
674
|
+
phone: string | null;
|
|
675
|
+
is_active: boolean;
|
|
676
|
+
roles: string[];
|
|
677
|
+
created_at: string;
|
|
678
|
+
}
|
|
679
|
+
interface AdminUserDetail {
|
|
680
|
+
id: string;
|
|
681
|
+
email: string | null;
|
|
682
|
+
phone: string | null;
|
|
683
|
+
display_name: string | null;
|
|
684
|
+
county: string | null;
|
|
685
|
+
city_id: string | null;
|
|
686
|
+
is_active: boolean;
|
|
687
|
+
suspended_at: string | null;
|
|
688
|
+
suspension_reason: string | null;
|
|
689
|
+
onboarding_completed: number;
|
|
690
|
+
email_verified: number;
|
|
691
|
+
created_at: string;
|
|
692
|
+
roles: string[];
|
|
693
|
+
order_count: number;
|
|
694
|
+
seller: {
|
|
695
|
+
sti_score: number;
|
|
696
|
+
seller_type: string;
|
|
697
|
+
verification_status: string;
|
|
698
|
+
} | null;
|
|
699
|
+
}
|
|
700
|
+
interface AdminStoreListItem {
|
|
701
|
+
id: string;
|
|
702
|
+
name: string;
|
|
703
|
+
slug: string;
|
|
704
|
+
seller_id: string;
|
|
705
|
+
is_verified: boolean;
|
|
706
|
+
subscription_tier: 'free' | 'pro';
|
|
707
|
+
sti_score: number | null;
|
|
708
|
+
created_at: string;
|
|
709
|
+
}
|
|
710
|
+
interface AdminStoreDetail {
|
|
711
|
+
id: string;
|
|
712
|
+
seller_id: string;
|
|
713
|
+
name: string;
|
|
714
|
+
slug: string;
|
|
715
|
+
tagline: string | null;
|
|
716
|
+
description: string | null;
|
|
717
|
+
category: string | null;
|
|
718
|
+
logo_url: string | null;
|
|
719
|
+
banner_url: string | null;
|
|
720
|
+
city_id: string | null;
|
|
721
|
+
subscription_tier: 'free' | 'pro';
|
|
722
|
+
is_verified: boolean;
|
|
723
|
+
created_at: string;
|
|
724
|
+
updated_at: string;
|
|
725
|
+
owner_name: string | null;
|
|
726
|
+
owner_email: string | null;
|
|
727
|
+
sti_score: number | null;
|
|
728
|
+
seller_type: string | null;
|
|
729
|
+
verification_status: string | null;
|
|
730
|
+
listing_count: number;
|
|
731
|
+
order_count: number;
|
|
732
|
+
}
|
|
733
|
+
interface AdminVerificationItem {
|
|
734
|
+
user_id: string;
|
|
735
|
+
seller_type: string;
|
|
736
|
+
verification_status: 'unverified' | 'pending' | 'verified' | 'rejected';
|
|
737
|
+
updated_at: string;
|
|
738
|
+
display_name: string | null;
|
|
739
|
+
email: string | null;
|
|
740
|
+
phone: string | null;
|
|
741
|
+
id_document_url: string | null;
|
|
742
|
+
kra_pin: string | null;
|
|
743
|
+
}
|
|
744
|
+
interface StiEvent {
|
|
745
|
+
trigger_type: string;
|
|
746
|
+
trigger_order_id: string | null;
|
|
747
|
+
score_before: number;
|
|
748
|
+
score_after: number;
|
|
749
|
+
delta: number;
|
|
750
|
+
reason: string;
|
|
751
|
+
created_at: string;
|
|
752
|
+
}
|
|
753
|
+
interface AdminListingItem {
|
|
754
|
+
id: string;
|
|
755
|
+
title: string;
|
|
756
|
+
price: number;
|
|
757
|
+
status: 'draft' | 'active' | 'sold' | 'removed';
|
|
758
|
+
photo_verified: boolean;
|
|
759
|
+
seller_id: string;
|
|
760
|
+
store_id: string | null;
|
|
761
|
+
created_at: string;
|
|
762
|
+
image_url: string | null;
|
|
763
|
+
}
|
|
764
|
+
interface AdminOrderListItem {
|
|
765
|
+
id: string;
|
|
766
|
+
buyer_id: string;
|
|
767
|
+
seller_id: string;
|
|
768
|
+
store_id: string | null;
|
|
769
|
+
total: number;
|
|
770
|
+
status: string;
|
|
771
|
+
created_at: string;
|
|
772
|
+
listing_title: string | null;
|
|
773
|
+
}
|
|
774
|
+
interface AdminOrderDetail {
|
|
775
|
+
id: string;
|
|
776
|
+
buyer_id: string;
|
|
777
|
+
seller_id: string;
|
|
778
|
+
store_id: string | null;
|
|
779
|
+
listing_id: string;
|
|
780
|
+
amount: number;
|
|
781
|
+
delivery_fee: number;
|
|
782
|
+
total: number;
|
|
783
|
+
status: string;
|
|
784
|
+
city_id: string;
|
|
785
|
+
created_at: string;
|
|
786
|
+
updated_at: string;
|
|
787
|
+
events: unknown[];
|
|
788
|
+
payment: unknown | null;
|
|
789
|
+
payout: unknown | null;
|
|
790
|
+
dispute: unknown | null;
|
|
791
|
+
}
|
|
792
|
+
interface AdminPayoutItem {
|
|
793
|
+
id: string;
|
|
794
|
+
order_id: string;
|
|
795
|
+
seller_id: string;
|
|
796
|
+
amount: number;
|
|
797
|
+
provider: string;
|
|
798
|
+
status: 'pending' | 'sent' | 'failed';
|
|
799
|
+
on_hold: boolean;
|
|
800
|
+
created_at: string;
|
|
801
|
+
}
|
|
802
|
+
interface AdminReport {
|
|
803
|
+
id: string;
|
|
804
|
+
reporter_id: string;
|
|
805
|
+
target_type: 'listing' | 'review' | 'store' | 'user';
|
|
806
|
+
target_id: string;
|
|
807
|
+
reason: string;
|
|
808
|
+
detail: string | null;
|
|
809
|
+
status: 'open' | 'reviewed' | 'dismissed' | 'actioned';
|
|
810
|
+
created_at: string;
|
|
811
|
+
}
|
|
812
|
+
interface AdminVaziOutfit {
|
|
813
|
+
id: string;
|
|
814
|
+
name: string;
|
|
815
|
+
seed_listing_id: string;
|
|
816
|
+
render_status: string;
|
|
817
|
+
removed: boolean;
|
|
818
|
+
item_count: number;
|
|
819
|
+
total_price: number;
|
|
820
|
+
engagement_impressions: number;
|
|
821
|
+
engagement_clicks: number;
|
|
822
|
+
engagement_purchases: number;
|
|
823
|
+
assembled_at: string;
|
|
824
|
+
}
|
|
825
|
+
interface CreateReportInput {
|
|
826
|
+
target_type: 'listing' | 'review' | 'store' | 'user';
|
|
827
|
+
target_id: string;
|
|
828
|
+
reason: 'counterfeit' | 'offensive' | 'spam' | 'scam' | 'other';
|
|
829
|
+
detail?: string;
|
|
830
|
+
}
|
|
670
831
|
|
|
671
832
|
declare const DISPUTE_REASONS: readonly ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
|
|
672
833
|
type DisputeReason = typeof DISPUTE_REASONS[number];
|
|
@@ -1446,39 +1607,202 @@ declare class BusinessesModule {
|
|
|
1446
1607
|
declare class AdminModule {
|
|
1447
1608
|
private readonly client;
|
|
1448
1609
|
constructor(client: APIClient);
|
|
1449
|
-
/** Block an IP address. Default duration: 24 hours. */
|
|
1450
1610
|
blockIp(ip: string, durationHours?: number, options?: RequestOptions): Promise<{
|
|
1451
1611
|
ok: true;
|
|
1452
1612
|
blocked: string;
|
|
1453
1613
|
hours: number;
|
|
1454
1614
|
}>;
|
|
1455
|
-
/** Unblock an IP address. */
|
|
1456
1615
|
unblockIp(ip: string, options?: RequestOptions): Promise<{
|
|
1457
1616
|
ok: true;
|
|
1458
1617
|
unblocked: string;
|
|
1459
1618
|
}>;
|
|
1460
|
-
/** List currently blocked IPs. */
|
|
1461
1619
|
getBlockedIps(options?: RequestOptions): Promise<{
|
|
1462
1620
|
data: BlockedIp[];
|
|
1463
1621
|
}>;
|
|
1464
|
-
/** Get platform-wide statistics. */
|
|
1465
1622
|
getSystemStats(options?: RequestOptions): Promise<SystemStats>;
|
|
1466
|
-
|
|
1623
|
+
getStatsTimeseries(params?: {
|
|
1624
|
+
metric?: 'orders' | 'gmv' | 'users';
|
|
1625
|
+
days?: number;
|
|
1626
|
+
}, options?: RequestOptions): Promise<{
|
|
1627
|
+
metric: string;
|
|
1628
|
+
days: number;
|
|
1629
|
+
data: {
|
|
1630
|
+
day: string;
|
|
1631
|
+
value: number;
|
|
1632
|
+
}[];
|
|
1633
|
+
}>;
|
|
1634
|
+
getStatsByCity(options?: RequestOptions): Promise<{
|
|
1635
|
+
data: {
|
|
1636
|
+
city: string;
|
|
1637
|
+
orders: number;
|
|
1638
|
+
gmv: number;
|
|
1639
|
+
}[];
|
|
1640
|
+
}>;
|
|
1641
|
+
listUsers(params?: {
|
|
1642
|
+
q?: string;
|
|
1643
|
+
page?: number;
|
|
1644
|
+
}, options?: RequestOptions): Promise<{
|
|
1645
|
+
data: AdminUserListItem[];
|
|
1646
|
+
page: number;
|
|
1647
|
+
page_size: number;
|
|
1648
|
+
}>;
|
|
1649
|
+
getUser(userId: string, options?: RequestOptions): Promise<AdminUserDetail>;
|
|
1467
1650
|
suspendUser(userId: string, reason: string, options?: RequestOptions): Promise<{
|
|
1468
1651
|
ok: true;
|
|
1469
1652
|
}>;
|
|
1470
|
-
/** Unsuspend a user account. */
|
|
1471
1653
|
unsuspendUser(userId: string, options?: RequestOptions): Promise<{
|
|
1472
1654
|
ok: true;
|
|
1473
1655
|
}>;
|
|
1474
|
-
|
|
1656
|
+
setUserRole(userId: string, role: string, action: 'grant' | 'revoke', options?: RequestOptions): Promise<{
|
|
1657
|
+
ok: true;
|
|
1658
|
+
roles: string[];
|
|
1659
|
+
}>;
|
|
1660
|
+
revokeUserSessions(userId: string, options?: RequestOptions): Promise<{
|
|
1661
|
+
ok: true;
|
|
1662
|
+
}>;
|
|
1663
|
+
listStores(params?: {
|
|
1664
|
+
q?: string;
|
|
1665
|
+
verified?: 0 | 1;
|
|
1666
|
+
tier?: 'free' | 'pro';
|
|
1667
|
+
page?: number;
|
|
1668
|
+
}, options?: RequestOptions): Promise<{
|
|
1669
|
+
data: AdminStoreListItem[];
|
|
1670
|
+
page: number;
|
|
1671
|
+
page_size: number;
|
|
1672
|
+
}>;
|
|
1673
|
+
getStore(storeId: string, options?: RequestOptions): Promise<AdminStoreDetail>;
|
|
1475
1674
|
verifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1476
1675
|
ok: true;
|
|
1477
1676
|
}>;
|
|
1478
|
-
/** Revoke verified badge from a store. */
|
|
1479
1677
|
unverifyStore(storeId: string, options?: RequestOptions): Promise<{
|
|
1480
1678
|
ok: true;
|
|
1481
1679
|
}>;
|
|
1680
|
+
listVerifications(params?: {
|
|
1681
|
+
status?: 'pending' | 'verified' | 'rejected' | 'unverified';
|
|
1682
|
+
page?: number;
|
|
1683
|
+
}, options?: RequestOptions): Promise<{
|
|
1684
|
+
data: AdminVerificationItem[];
|
|
1685
|
+
page: number;
|
|
1686
|
+
page_size: number;
|
|
1687
|
+
}>;
|
|
1688
|
+
approveVerification(userId: string, options?: RequestOptions): Promise<{
|
|
1689
|
+
ok: true;
|
|
1690
|
+
verification_status: 'verified';
|
|
1691
|
+
}>;
|
|
1692
|
+
rejectVerification(userId: string, reason?: string, options?: RequestOptions): Promise<{
|
|
1693
|
+
ok: true;
|
|
1694
|
+
verification_status: 'rejected';
|
|
1695
|
+
}>;
|
|
1696
|
+
adjustSti(userId: string, input: {
|
|
1697
|
+
score?: number;
|
|
1698
|
+
delta?: number;
|
|
1699
|
+
reason: string;
|
|
1700
|
+
}, options?: RequestOptions): Promise<{
|
|
1701
|
+
ok: true;
|
|
1702
|
+
score_before: number;
|
|
1703
|
+
score_after: number;
|
|
1704
|
+
}>;
|
|
1705
|
+
getStiEvents(userId: string, params?: {
|
|
1706
|
+
page?: number;
|
|
1707
|
+
}, options?: RequestOptions): Promise<{
|
|
1708
|
+
data: StiEvent[];
|
|
1709
|
+
page: number;
|
|
1710
|
+
page_size: number;
|
|
1711
|
+
}>;
|
|
1712
|
+
listListings(params?: {
|
|
1713
|
+
status?: string;
|
|
1714
|
+
photo_verified?: 0 | 1;
|
|
1715
|
+
page?: number;
|
|
1716
|
+
}, options?: RequestOptions): Promise<{
|
|
1717
|
+
data: AdminListingItem[];
|
|
1718
|
+
page: number;
|
|
1719
|
+
page_size: number;
|
|
1720
|
+
}>;
|
|
1721
|
+
removeListing(listingId: string, reason?: string, options?: RequestOptions): Promise<{
|
|
1722
|
+
ok: true;
|
|
1723
|
+
status: 'removed';
|
|
1724
|
+
}>;
|
|
1725
|
+
reinstateListing(listingId: string, options?: RequestOptions): Promise<{
|
|
1726
|
+
ok: true;
|
|
1727
|
+
status: 'active';
|
|
1728
|
+
}>;
|
|
1729
|
+
listOrders(params?: {
|
|
1730
|
+
status?: string;
|
|
1731
|
+
q?: string;
|
|
1732
|
+
page?: number;
|
|
1733
|
+
}, options?: RequestOptions): Promise<{
|
|
1734
|
+
data: AdminOrderListItem[];
|
|
1735
|
+
page: number;
|
|
1736
|
+
page_size: number;
|
|
1737
|
+
}>;
|
|
1738
|
+
getOrder(orderId: string, options?: RequestOptions): Promise<AdminOrderDetail>;
|
|
1739
|
+
forceTransitionOrder(orderId: string, status: string, note?: string, options?: RequestOptions): Promise<{
|
|
1740
|
+
ok: true;
|
|
1741
|
+
status: string;
|
|
1742
|
+
}>;
|
|
1743
|
+
getPayoutSummary(options?: RequestOptions): Promise<{
|
|
1744
|
+
owed: number;
|
|
1745
|
+
held: number;
|
|
1746
|
+
sent_today: number;
|
|
1747
|
+
}>;
|
|
1748
|
+
listPayouts(params?: {
|
|
1749
|
+
status?: 'pending' | 'sent' | 'failed';
|
|
1750
|
+
on_hold?: 0 | 1;
|
|
1751
|
+
page?: number;
|
|
1752
|
+
}, options?: RequestOptions): Promise<{
|
|
1753
|
+
data: AdminPayoutItem[];
|
|
1754
|
+
page: number;
|
|
1755
|
+
page_size: number;
|
|
1756
|
+
}>;
|
|
1757
|
+
disbursePayout(payoutId: string, options?: RequestOptions): Promise<{
|
|
1758
|
+
ok: true;
|
|
1759
|
+
result: unknown;
|
|
1760
|
+
}>;
|
|
1761
|
+
listReports(params?: {
|
|
1762
|
+
status?: 'open' | 'reviewed' | 'dismissed' | 'actioned';
|
|
1763
|
+
type?: 'listing' | 'review' | 'store' | 'user';
|
|
1764
|
+
page?: number;
|
|
1765
|
+
}, options?: RequestOptions): Promise<{
|
|
1766
|
+
data: AdminReport[];
|
|
1767
|
+
page: number;
|
|
1768
|
+
page_size: number;
|
|
1769
|
+
}>;
|
|
1770
|
+
resolveReport(reportId: string, status: 'reviewed' | 'dismissed' | 'actioned', note?: string, options?: RequestOptions): Promise<{
|
|
1771
|
+
ok: true;
|
|
1772
|
+
status: string;
|
|
1773
|
+
}>;
|
|
1774
|
+
removeReview(reviewId: string, reason?: string, options?: RequestOptions): Promise<{
|
|
1775
|
+
ok: true;
|
|
1776
|
+
hidden: true;
|
|
1777
|
+
}>;
|
|
1778
|
+
reinstateReview(reviewId: string, options?: RequestOptions): Promise<{
|
|
1779
|
+
ok: true;
|
|
1780
|
+
hidden: false;
|
|
1781
|
+
}>;
|
|
1782
|
+
listVaziOutfits(params?: {
|
|
1783
|
+
page?: number;
|
|
1784
|
+
}, options?: RequestOptions): Promise<{
|
|
1785
|
+
data: AdminVaziOutfit[];
|
|
1786
|
+
page: number;
|
|
1787
|
+
page_size: number;
|
|
1788
|
+
}>;
|
|
1789
|
+
removeVaziOutfit(outfitId: string, reason?: string, options?: RequestOptions): Promise<{
|
|
1790
|
+
ok: true;
|
|
1791
|
+
removed: true;
|
|
1792
|
+
}>;
|
|
1793
|
+
reinstateVaziOutfit(outfitId: string, options?: RequestOptions): Promise<{
|
|
1794
|
+
ok: true;
|
|
1795
|
+
removed: false;
|
|
1796
|
+
}>;
|
|
1797
|
+
broadcast(input: {
|
|
1798
|
+
title: string;
|
|
1799
|
+
body: string;
|
|
1800
|
+
segment?: 'all' | 'sellers' | 'buyers';
|
|
1801
|
+
}, options?: RequestOptions): Promise<{
|
|
1802
|
+
ok: true;
|
|
1803
|
+
segment: string;
|
|
1804
|
+
recipients: number;
|
|
1805
|
+
}>;
|
|
1482
1806
|
}
|
|
1483
1807
|
|
|
1484
1808
|
declare class DisputesModule {
|
|
@@ -1539,6 +1863,16 @@ declare class UploadsModule {
|
|
|
1539
1863
|
}>;
|
|
1540
1864
|
}
|
|
1541
1865
|
|
|
1866
|
+
declare class ReportsModule {
|
|
1867
|
+
private readonly client;
|
|
1868
|
+
constructor(client: APIClient);
|
|
1869
|
+
/** Report a listing, review, store, or user for admin review. */
|
|
1870
|
+
create(input: CreateReportInput, options?: RequestOptions): Promise<{
|
|
1871
|
+
ok: true;
|
|
1872
|
+
already_reported?: boolean;
|
|
1873
|
+
}>;
|
|
1874
|
+
}
|
|
1875
|
+
|
|
1542
1876
|
declare class MitumbaClient {
|
|
1543
1877
|
readonly api: APIClient;
|
|
1544
1878
|
readonly auth: AuthModule;
|
|
@@ -1559,6 +1893,7 @@ declare class MitumbaClient {
|
|
|
1559
1893
|
readonly admin: AdminModule;
|
|
1560
1894
|
readonly disputes: DisputesModule;
|
|
1561
1895
|
readonly uploads: UploadsModule;
|
|
1896
|
+
readonly reports: ReportsModule;
|
|
1562
1897
|
constructor(config: MitumbaClientConfig);
|
|
1563
1898
|
/**
|
|
1564
1899
|
* Set the access token for authenticated requests.
|
|
@@ -1583,4 +1918,4 @@ declare class MitumbaClient {
|
|
|
1583
1918
|
isAuthenticated(): Promise<boolean>;
|
|
1584
1919
|
}
|
|
1585
1920
|
|
|
1586
|
-
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, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WishlistListing, WishlistsModule, createTokenStore };
|
|
1921
|
+
export { APIClient, APIError, type APIErrorResponse, 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 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, type TokenStore, type TransitionOrderInput, type TrendingTerm, 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 };
|
package/dist/index.js
CHANGED
|
@@ -1075,38 +1075,133 @@ var AdminModule = class {
|
|
|
1075
1075
|
this.client = client;
|
|
1076
1076
|
}
|
|
1077
1077
|
client;
|
|
1078
|
-
|
|
1078
|
+
// ── IP Blocking ──
|
|
1079
1079
|
async blockIp(ip, durationHours, options) {
|
|
1080
1080
|
return this.client.post("/admin/block-ip", { ip, duration_hours: durationHours ?? 24 }, options);
|
|
1081
1081
|
}
|
|
1082
|
-
/** Unblock an IP address. */
|
|
1083
1082
|
async unblockIp(ip, options) {
|
|
1084
1083
|
return this.client.post("/admin/unblock-ip", { ip }, options);
|
|
1085
1084
|
}
|
|
1086
|
-
/** List currently blocked IPs. */
|
|
1087
1085
|
async getBlockedIps(options) {
|
|
1088
1086
|
return this.client.get("/admin/blocked-ips", void 0, options);
|
|
1089
1087
|
}
|
|
1090
|
-
|
|
1088
|
+
// ── Stats ──
|
|
1091
1089
|
async getSystemStats(options) {
|
|
1092
1090
|
return this.client.get("/admin/stats", void 0, options);
|
|
1093
1091
|
}
|
|
1094
|
-
|
|
1092
|
+
async getStatsTimeseries(params, options) {
|
|
1093
|
+
return this.client.get("/admin/stats/timeseries", params, options);
|
|
1094
|
+
}
|
|
1095
|
+
async getStatsByCity(options) {
|
|
1096
|
+
return this.client.get("/admin/stats/by-city", void 0, options);
|
|
1097
|
+
}
|
|
1098
|
+
// ── Users ──
|
|
1099
|
+
async listUsers(params, options) {
|
|
1100
|
+
return this.client.get("/admin/users", params, options);
|
|
1101
|
+
}
|
|
1102
|
+
async getUser(userId, options) {
|
|
1103
|
+
return this.client.get(`/admin/users/${userId}`, void 0, options);
|
|
1104
|
+
}
|
|
1095
1105
|
async suspendUser(userId, reason, options) {
|
|
1096
1106
|
return this.client.post(`/admin/users/${userId}/suspend`, { reason }, options);
|
|
1097
1107
|
}
|
|
1098
|
-
/** Unsuspend a user account. */
|
|
1099
1108
|
async unsuspendUser(userId, options) {
|
|
1100
1109
|
return this.client.post(`/admin/users/${userId}/unsuspend`, void 0, options);
|
|
1101
1110
|
}
|
|
1102
|
-
|
|
1111
|
+
async setUserRole(userId, role, action, options) {
|
|
1112
|
+
return this.client.post(`/admin/users/${userId}/roles`, { role, action }, options);
|
|
1113
|
+
}
|
|
1114
|
+
async revokeUserSessions(userId, options) {
|
|
1115
|
+
return this.client.post(`/admin/users/${userId}/revoke-sessions`, void 0, options);
|
|
1116
|
+
}
|
|
1117
|
+
// ── Stores ──
|
|
1118
|
+
async listStores(params, options) {
|
|
1119
|
+
return this.client.get("/admin/stores", params, options);
|
|
1120
|
+
}
|
|
1121
|
+
async getStore(storeId, options) {
|
|
1122
|
+
return this.client.get(`/admin/stores/${storeId}`, void 0, options);
|
|
1123
|
+
}
|
|
1103
1124
|
async verifyStore(storeId, options) {
|
|
1104
1125
|
return this.client.post(`/admin/stores/${storeId}/verify`, void 0, options);
|
|
1105
1126
|
}
|
|
1106
|
-
/** Revoke verified badge from a store. */
|
|
1107
1127
|
async unverifyStore(storeId, options) {
|
|
1108
1128
|
return this.client.post(`/admin/stores/${storeId}/unverify`, void 0, options);
|
|
1109
1129
|
}
|
|
1130
|
+
// ── Verification Queue ──
|
|
1131
|
+
async listVerifications(params, options) {
|
|
1132
|
+
return this.client.get("/admin/verifications", params, options);
|
|
1133
|
+
}
|
|
1134
|
+
async approveVerification(userId, options) {
|
|
1135
|
+
return this.client.post(`/admin/verifications/${userId}/approve`, void 0, options);
|
|
1136
|
+
}
|
|
1137
|
+
async rejectVerification(userId, reason, options) {
|
|
1138
|
+
return this.client.post(`/admin/verifications/${userId}/reject`, reason ? { reason } : void 0, options);
|
|
1139
|
+
}
|
|
1140
|
+
// ── STI ──
|
|
1141
|
+
async adjustSti(userId, input, options) {
|
|
1142
|
+
return this.client.post(`/admin/sellers/${userId}/sti`, input, options);
|
|
1143
|
+
}
|
|
1144
|
+
async getStiEvents(userId, params, options) {
|
|
1145
|
+
return this.client.get(`/admin/sellers/${userId}/sti-events`, params, options);
|
|
1146
|
+
}
|
|
1147
|
+
// ── Listings Moderation ──
|
|
1148
|
+
async listListings(params, options) {
|
|
1149
|
+
return this.client.get("/admin/listings", params, options);
|
|
1150
|
+
}
|
|
1151
|
+
async removeListing(listingId, reason, options) {
|
|
1152
|
+
return this.client.post(`/admin/listings/${listingId}/remove`, reason ? { reason } : void 0, options);
|
|
1153
|
+
}
|
|
1154
|
+
async reinstateListing(listingId, options) {
|
|
1155
|
+
return this.client.post(`/admin/listings/${listingId}/reinstate`, void 0, options);
|
|
1156
|
+
}
|
|
1157
|
+
// ── Orders ──
|
|
1158
|
+
async listOrders(params, options) {
|
|
1159
|
+
return this.client.get("/admin/orders", params, options);
|
|
1160
|
+
}
|
|
1161
|
+
async getOrder(orderId, options) {
|
|
1162
|
+
return this.client.get(`/admin/orders/${orderId}`, void 0, options);
|
|
1163
|
+
}
|
|
1164
|
+
async forceTransitionOrder(orderId, status, note, options) {
|
|
1165
|
+
return this.client.post(`/admin/orders/${orderId}/transition`, { status, note }, options);
|
|
1166
|
+
}
|
|
1167
|
+
// ── Payouts ──
|
|
1168
|
+
async getPayoutSummary(options) {
|
|
1169
|
+
return this.client.get("/admin/payouts/summary", void 0, options);
|
|
1170
|
+
}
|
|
1171
|
+
async listPayouts(params, options) {
|
|
1172
|
+
return this.client.get("/admin/payouts", params, options);
|
|
1173
|
+
}
|
|
1174
|
+
async disbursePayout(payoutId, options) {
|
|
1175
|
+
return this.client.post(`/admin/payouts/${payoutId}/disburse`, void 0, options);
|
|
1176
|
+
}
|
|
1177
|
+
// ── Reports Moderation ──
|
|
1178
|
+
async listReports(params, options) {
|
|
1179
|
+
return this.client.get("/admin/reports", params, options);
|
|
1180
|
+
}
|
|
1181
|
+
async resolveReport(reportId, status, note, options) {
|
|
1182
|
+
return this.client.post(`/admin/reports/${reportId}/resolve`, { status, note }, options);
|
|
1183
|
+
}
|
|
1184
|
+
// ── Review Moderation ──
|
|
1185
|
+
async removeReview(reviewId, reason, options) {
|
|
1186
|
+
return this.client.post(`/admin/reviews/${reviewId}/remove`, reason ? { reason } : void 0, options);
|
|
1187
|
+
}
|
|
1188
|
+
async reinstateReview(reviewId, options) {
|
|
1189
|
+
return this.client.post(`/admin/reviews/${reviewId}/reinstate`, void 0, options);
|
|
1190
|
+
}
|
|
1191
|
+
// ── VAZI Moderation ──
|
|
1192
|
+
async listVaziOutfits(params, options) {
|
|
1193
|
+
return this.client.get("/admin/vazi/outfits", params, options);
|
|
1194
|
+
}
|
|
1195
|
+
async removeVaziOutfit(outfitId, reason, options) {
|
|
1196
|
+
return this.client.post(`/admin/vazi/outfits/${outfitId}/remove`, reason ? { reason } : void 0, options);
|
|
1197
|
+
}
|
|
1198
|
+
async reinstateVaziOutfit(outfitId, options) {
|
|
1199
|
+
return this.client.post(`/admin/vazi/outfits/${outfitId}/reinstate`, void 0, options);
|
|
1200
|
+
}
|
|
1201
|
+
// ── Broadcast ──
|
|
1202
|
+
async broadcast(input, options) {
|
|
1203
|
+
return this.client.post("/admin/broadcast", input, options);
|
|
1204
|
+
}
|
|
1110
1205
|
};
|
|
1111
1206
|
|
|
1112
1207
|
// src/modules/disputes.ts
|
|
@@ -1171,6 +1266,18 @@ var UploadsModule = class {
|
|
|
1171
1266
|
}
|
|
1172
1267
|
};
|
|
1173
1268
|
|
|
1269
|
+
// src/modules/reports.ts
|
|
1270
|
+
var ReportsModule = class {
|
|
1271
|
+
constructor(client) {
|
|
1272
|
+
this.client = client;
|
|
1273
|
+
}
|
|
1274
|
+
client;
|
|
1275
|
+
/** Report a listing, review, store, or user for admin review. */
|
|
1276
|
+
async create(input, options) {
|
|
1277
|
+
return this.client.post("/listings/reports", input, options);
|
|
1278
|
+
}
|
|
1279
|
+
};
|
|
1280
|
+
|
|
1174
1281
|
// src/types/listings.ts
|
|
1175
1282
|
var CONDITIONS = ["new", "like_new", "good", "fair"];
|
|
1176
1283
|
var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
|
|
@@ -1217,6 +1324,7 @@ var MitumbaClient = class {
|
|
|
1217
1324
|
admin;
|
|
1218
1325
|
disputes;
|
|
1219
1326
|
uploads;
|
|
1327
|
+
reports;
|
|
1220
1328
|
constructor(config) {
|
|
1221
1329
|
this.api = new APIClient(config);
|
|
1222
1330
|
this.auth = new AuthModule(this.api);
|
|
@@ -1237,6 +1345,7 @@ var MitumbaClient = class {
|
|
|
1237
1345
|
this.admin = new AdminModule(this.api);
|
|
1238
1346
|
this.disputes = new DisputesModule(this.api);
|
|
1239
1347
|
this.uploads = new UploadsModule(this.api);
|
|
1348
|
+
this.reports = new ReportsModule(this.api);
|
|
1240
1349
|
}
|
|
1241
1350
|
/**
|
|
1242
1351
|
* Set the access token for authenticated requests.
|
|
@@ -1294,6 +1403,7 @@ exports.ORDER_STATUSES = ORDER_STATUSES;
|
|
|
1294
1403
|
exports.OrdersModule = OrdersModule;
|
|
1295
1404
|
exports.PAYMENT_STATUSES = PAYMENT_STATUSES;
|
|
1296
1405
|
exports.PayModule = PayModule;
|
|
1406
|
+
exports.ReportsModule = ReportsModule;
|
|
1297
1407
|
exports.ReviewsModule = ReviewsModule;
|
|
1298
1408
|
exports.SearchModule = SearchModule;
|
|
1299
1409
|
exports.SettingsModule = SettingsModule;
|