@mitumba/sdk 1.14.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 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
- /** Suspend a user account. */
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
- /** Grant verified badge to a store. */
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 {
@@ -1530,6 +1854,25 @@ declare class DisputesModule {
1530
1854
  }>;
1531
1855
  }
1532
1856
 
1857
+ declare class UploadsModule {
1858
+ private readonly client;
1859
+ constructor(client: APIClient);
1860
+ /** Upload a file (avatar, evidence, etc). Returns the public CDN URL. */
1861
+ upload(file: Blob, options?: RequestOptions): Promise<{
1862
+ url: string;
1863
+ }>;
1864
+ }
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
+
1533
1876
  declare class MitumbaClient {
1534
1877
  readonly api: APIClient;
1535
1878
  readonly auth: AuthModule;
@@ -1549,6 +1892,8 @@ declare class MitumbaClient {
1549
1892
  readonly businesses: BusinessesModule;
1550
1893
  readonly admin: AdminModule;
1551
1894
  readonly disputes: DisputesModule;
1895
+ readonly uploads: UploadsModule;
1896
+ readonly reports: ReportsModule;
1552
1897
  constructor(config: MitumbaClientConfig);
1553
1898
  /**
1554
1899
  * Set the access token for authenticated requests.
@@ -1573,4 +1918,4 @@ declare class MitumbaClient {
1573
1918
  isAuthenticated(): Promise<boolean>;
1574
1919
  }
1575
1920
 
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 };
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 };