@mitumba/sdk 1.15.0 → 1.17.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
@@ -145,6 +145,7 @@ interface Listing {
145
145
  seller_type: 'individual' | 'bale';
146
146
  images?: ListingImage[];
147
147
  image_url?: string | null;
148
+ media?: string[];
148
149
  }
149
150
  interface ListingsFeedParams {
150
151
  city_id?: string;
@@ -545,6 +546,7 @@ interface WishlistListing {
545
546
  condition: string;
546
547
  size: string | null;
547
548
  image_url: string | null;
549
+ media?: string[];
548
550
  }
549
551
 
550
552
  interface CartItem {
@@ -667,6 +669,167 @@ interface SystemStats {
667
669
  total_revenue: number;
668
670
  active_today: number;
669
671
  }
672
+ interface AdminUserListItem {
673
+ id: string;
674
+ display_name: string | null;
675
+ email: string | null;
676
+ phone: string | null;
677
+ is_active: boolean;
678
+ roles: string[];
679
+ created_at: string;
680
+ }
681
+ interface AdminUserDetail {
682
+ id: string;
683
+ email: string | null;
684
+ phone: string | null;
685
+ display_name: string | null;
686
+ county: string | null;
687
+ city_id: string | null;
688
+ is_active: boolean;
689
+ suspended_at: string | null;
690
+ suspension_reason: string | null;
691
+ onboarding_completed: number;
692
+ email_verified: number;
693
+ created_at: string;
694
+ roles: string[];
695
+ order_count: number;
696
+ seller: {
697
+ sti_score: number;
698
+ seller_type: string;
699
+ verification_status: string;
700
+ } | null;
701
+ }
702
+ interface AdminStoreListItem {
703
+ id: string;
704
+ name: string;
705
+ slug: string;
706
+ seller_id: string;
707
+ is_verified: boolean;
708
+ subscription_tier: 'free' | 'pro';
709
+ sti_score: number | null;
710
+ created_at: string;
711
+ }
712
+ interface AdminStoreDetail {
713
+ id: string;
714
+ seller_id: string;
715
+ name: string;
716
+ slug: string;
717
+ tagline: string | null;
718
+ description: string | null;
719
+ category: string | null;
720
+ logo_url: string | null;
721
+ banner_url: string | null;
722
+ city_id: string | null;
723
+ subscription_tier: 'free' | 'pro';
724
+ is_verified: boolean;
725
+ created_at: string;
726
+ updated_at: string;
727
+ owner_name: string | null;
728
+ owner_email: string | null;
729
+ sti_score: number | null;
730
+ seller_type: string | null;
731
+ verification_status: string | null;
732
+ listing_count: number;
733
+ order_count: number;
734
+ }
735
+ interface AdminVerificationItem {
736
+ user_id: string;
737
+ seller_type: string;
738
+ verification_status: 'unverified' | 'pending' | 'verified' | 'rejected';
739
+ updated_at: string;
740
+ display_name: string | null;
741
+ email: string | null;
742
+ phone: string | null;
743
+ id_document_url: string | null;
744
+ kra_pin: string | null;
745
+ }
746
+ interface StiEvent {
747
+ trigger_type: string;
748
+ trigger_order_id: string | null;
749
+ score_before: number;
750
+ score_after: number;
751
+ delta: number;
752
+ reason: string;
753
+ created_at: string;
754
+ }
755
+ interface AdminListingItem {
756
+ id: string;
757
+ title: string;
758
+ price: number;
759
+ status: 'draft' | 'active' | 'sold' | 'removed';
760
+ photo_verified: boolean;
761
+ seller_id: string;
762
+ store_id: string | null;
763
+ created_at: string;
764
+ image_url: string | null;
765
+ }
766
+ interface AdminOrderListItem {
767
+ id: string;
768
+ buyer_id: string;
769
+ seller_id: string;
770
+ store_id: string | null;
771
+ total: number;
772
+ status: string;
773
+ created_at: string;
774
+ listing_title: string | null;
775
+ }
776
+ interface AdminOrderDetail {
777
+ id: string;
778
+ buyer_id: string;
779
+ seller_id: string;
780
+ store_id: string | null;
781
+ listing_id: string;
782
+ amount: number;
783
+ delivery_fee: number;
784
+ total: number;
785
+ status: string;
786
+ city_id: string;
787
+ created_at: string;
788
+ updated_at: string;
789
+ events: unknown[];
790
+ payment: unknown | null;
791
+ payout: unknown | null;
792
+ dispute: unknown | null;
793
+ }
794
+ interface AdminPayoutItem {
795
+ id: string;
796
+ order_id: string;
797
+ seller_id: string;
798
+ amount: number;
799
+ provider: string;
800
+ status: 'pending' | 'sent' | 'failed';
801
+ on_hold: boolean;
802
+ created_at: string;
803
+ }
804
+ interface AdminReport {
805
+ id: string;
806
+ reporter_id: string;
807
+ target_type: 'listing' | 'review' | 'store' | 'user';
808
+ target_id: string;
809
+ reason: string;
810
+ detail: string | null;
811
+ status: 'open' | 'reviewed' | 'dismissed' | 'actioned';
812
+ created_at: string;
813
+ }
814
+ interface AdminVaziOutfit {
815
+ id: string;
816
+ name: string;
817
+ seed_listing_id: string;
818
+ render_status: string;
819
+ removed: boolean;
820
+ item_count: number;
821
+ total_price: number;
822
+ engagement_impressions: number;
823
+ engagement_clicks: number;
824
+ engagement_purchases: number;
825
+ assembled_at: string;
826
+ }
827
+ interface CreateReportInput {
828
+ target_type: 'listing' | 'review' | 'store' | 'user';
829
+ target_id: string;
830
+ reason: 'counterfeit' | 'offensive' | 'spam' | 'scam' | 'other';
831
+ detail?: string;
832
+ }
670
833
 
671
834
  declare const DISPUTE_REASONS: readonly ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
672
835
  type DisputeReason = typeof DISPUTE_REASONS[number];
@@ -1446,39 +1609,202 @@ declare class BusinessesModule {
1446
1609
  declare class AdminModule {
1447
1610
  private readonly client;
1448
1611
  constructor(client: APIClient);
1449
- /** Block an IP address. Default duration: 24 hours. */
1450
1612
  blockIp(ip: string, durationHours?: number, options?: RequestOptions): Promise<{
1451
1613
  ok: true;
1452
1614
  blocked: string;
1453
1615
  hours: number;
1454
1616
  }>;
1455
- /** Unblock an IP address. */
1456
1617
  unblockIp(ip: string, options?: RequestOptions): Promise<{
1457
1618
  ok: true;
1458
1619
  unblocked: string;
1459
1620
  }>;
1460
- /** List currently blocked IPs. */
1461
1621
  getBlockedIps(options?: RequestOptions): Promise<{
1462
1622
  data: BlockedIp[];
1463
1623
  }>;
1464
- /** Get platform-wide statistics. */
1465
1624
  getSystemStats(options?: RequestOptions): Promise<SystemStats>;
1466
- /** Suspend a user account. */
1625
+ getStatsTimeseries(params?: {
1626
+ metric?: 'orders' | 'gmv' | 'users';
1627
+ days?: number;
1628
+ }, options?: RequestOptions): Promise<{
1629
+ metric: string;
1630
+ days: number;
1631
+ data: {
1632
+ day: string;
1633
+ value: number;
1634
+ }[];
1635
+ }>;
1636
+ getStatsByCity(options?: RequestOptions): Promise<{
1637
+ data: {
1638
+ city: string;
1639
+ orders: number;
1640
+ gmv: number;
1641
+ }[];
1642
+ }>;
1643
+ listUsers(params?: {
1644
+ q?: string;
1645
+ page?: number;
1646
+ }, options?: RequestOptions): Promise<{
1647
+ data: AdminUserListItem[];
1648
+ page: number;
1649
+ page_size: number;
1650
+ }>;
1651
+ getUser(userId: string, options?: RequestOptions): Promise<AdminUserDetail>;
1467
1652
  suspendUser(userId: string, reason: string, options?: RequestOptions): Promise<{
1468
1653
  ok: true;
1469
1654
  }>;
1470
- /** Unsuspend a user account. */
1471
1655
  unsuspendUser(userId: string, options?: RequestOptions): Promise<{
1472
1656
  ok: true;
1473
1657
  }>;
1474
- /** Grant verified badge to a store. */
1658
+ setUserRole(userId: string, role: string, action: 'grant' | 'revoke', options?: RequestOptions): Promise<{
1659
+ ok: true;
1660
+ roles: string[];
1661
+ }>;
1662
+ revokeUserSessions(userId: string, options?: RequestOptions): Promise<{
1663
+ ok: true;
1664
+ }>;
1665
+ listStores(params?: {
1666
+ q?: string;
1667
+ verified?: 0 | 1;
1668
+ tier?: 'free' | 'pro';
1669
+ page?: number;
1670
+ }, options?: RequestOptions): Promise<{
1671
+ data: AdminStoreListItem[];
1672
+ page: number;
1673
+ page_size: number;
1674
+ }>;
1675
+ getStore(storeId: string, options?: RequestOptions): Promise<AdminStoreDetail>;
1475
1676
  verifyStore(storeId: string, options?: RequestOptions): Promise<{
1476
1677
  ok: true;
1477
1678
  }>;
1478
- /** Revoke verified badge from a store. */
1479
1679
  unverifyStore(storeId: string, options?: RequestOptions): Promise<{
1480
1680
  ok: true;
1481
1681
  }>;
1682
+ listVerifications(params?: {
1683
+ status?: 'pending' | 'verified' | 'rejected' | 'unverified';
1684
+ page?: number;
1685
+ }, options?: RequestOptions): Promise<{
1686
+ data: AdminVerificationItem[];
1687
+ page: number;
1688
+ page_size: number;
1689
+ }>;
1690
+ approveVerification(userId: string, options?: RequestOptions): Promise<{
1691
+ ok: true;
1692
+ verification_status: 'verified';
1693
+ }>;
1694
+ rejectVerification(userId: string, reason?: string, options?: RequestOptions): Promise<{
1695
+ ok: true;
1696
+ verification_status: 'rejected';
1697
+ }>;
1698
+ adjustSti(userId: string, input: {
1699
+ score?: number;
1700
+ delta?: number;
1701
+ reason: string;
1702
+ }, options?: RequestOptions): Promise<{
1703
+ ok: true;
1704
+ score_before: number;
1705
+ score_after: number;
1706
+ }>;
1707
+ getStiEvents(userId: string, params?: {
1708
+ page?: number;
1709
+ }, options?: RequestOptions): Promise<{
1710
+ data: StiEvent[];
1711
+ page: number;
1712
+ page_size: number;
1713
+ }>;
1714
+ listListings(params?: {
1715
+ status?: string;
1716
+ photo_verified?: 0 | 1;
1717
+ page?: number;
1718
+ }, options?: RequestOptions): Promise<{
1719
+ data: AdminListingItem[];
1720
+ page: number;
1721
+ page_size: number;
1722
+ }>;
1723
+ removeListing(listingId: string, reason?: string, options?: RequestOptions): Promise<{
1724
+ ok: true;
1725
+ status: 'removed';
1726
+ }>;
1727
+ reinstateListing(listingId: string, options?: RequestOptions): Promise<{
1728
+ ok: true;
1729
+ status: 'active';
1730
+ }>;
1731
+ listOrders(params?: {
1732
+ status?: string;
1733
+ q?: string;
1734
+ page?: number;
1735
+ }, options?: RequestOptions): Promise<{
1736
+ data: AdminOrderListItem[];
1737
+ page: number;
1738
+ page_size: number;
1739
+ }>;
1740
+ getOrder(orderId: string, options?: RequestOptions): Promise<AdminOrderDetail>;
1741
+ forceTransitionOrder(orderId: string, status: string, note?: string, options?: RequestOptions): Promise<{
1742
+ ok: true;
1743
+ status: string;
1744
+ }>;
1745
+ getPayoutSummary(options?: RequestOptions): Promise<{
1746
+ owed: number;
1747
+ held: number;
1748
+ sent_today: number;
1749
+ }>;
1750
+ listPayouts(params?: {
1751
+ status?: 'pending' | 'sent' | 'failed';
1752
+ on_hold?: 0 | 1;
1753
+ page?: number;
1754
+ }, options?: RequestOptions): Promise<{
1755
+ data: AdminPayoutItem[];
1756
+ page: number;
1757
+ page_size: number;
1758
+ }>;
1759
+ disbursePayout(payoutId: string, options?: RequestOptions): Promise<{
1760
+ ok: true;
1761
+ result: unknown;
1762
+ }>;
1763
+ listReports(params?: {
1764
+ status?: 'open' | 'reviewed' | 'dismissed' | 'actioned';
1765
+ type?: 'listing' | 'review' | 'store' | 'user';
1766
+ page?: number;
1767
+ }, options?: RequestOptions): Promise<{
1768
+ data: AdminReport[];
1769
+ page: number;
1770
+ page_size: number;
1771
+ }>;
1772
+ resolveReport(reportId: string, status: 'reviewed' | 'dismissed' | 'actioned', note?: string, options?: RequestOptions): Promise<{
1773
+ ok: true;
1774
+ status: string;
1775
+ }>;
1776
+ removeReview(reviewId: string, reason?: string, options?: RequestOptions): Promise<{
1777
+ ok: true;
1778
+ hidden: true;
1779
+ }>;
1780
+ reinstateReview(reviewId: string, options?: RequestOptions): Promise<{
1781
+ ok: true;
1782
+ hidden: false;
1783
+ }>;
1784
+ listVaziOutfits(params?: {
1785
+ page?: number;
1786
+ }, options?: RequestOptions): Promise<{
1787
+ data: AdminVaziOutfit[];
1788
+ page: number;
1789
+ page_size: number;
1790
+ }>;
1791
+ removeVaziOutfit(outfitId: string, reason?: string, options?: RequestOptions): Promise<{
1792
+ ok: true;
1793
+ removed: true;
1794
+ }>;
1795
+ reinstateVaziOutfit(outfitId: string, options?: RequestOptions): Promise<{
1796
+ ok: true;
1797
+ removed: false;
1798
+ }>;
1799
+ broadcast(input: {
1800
+ title: string;
1801
+ body: string;
1802
+ segment?: 'all' | 'sellers' | 'buyers';
1803
+ }, options?: RequestOptions): Promise<{
1804
+ ok: true;
1805
+ segment: string;
1806
+ recipients: number;
1807
+ }>;
1482
1808
  }
1483
1809
 
1484
1810
  declare class DisputesModule {
@@ -1539,6 +1865,16 @@ declare class UploadsModule {
1539
1865
  }>;
1540
1866
  }
1541
1867
 
1868
+ declare class ReportsModule {
1869
+ private readonly client;
1870
+ constructor(client: APIClient);
1871
+ /** Report a listing, review, store, or user for admin review. */
1872
+ create(input: CreateReportInput, options?: RequestOptions): Promise<{
1873
+ ok: true;
1874
+ already_reported?: boolean;
1875
+ }>;
1876
+ }
1877
+
1542
1878
  declare class MitumbaClient {
1543
1879
  readonly api: APIClient;
1544
1880
  readonly auth: AuthModule;
@@ -1559,6 +1895,7 @@ declare class MitumbaClient {
1559
1895
  readonly admin: AdminModule;
1560
1896
  readonly disputes: DisputesModule;
1561
1897
  readonly uploads: UploadsModule;
1898
+ readonly reports: ReportsModule;
1562
1899
  constructor(config: MitumbaClientConfig);
1563
1900
  /**
1564
1901
  * Set the access token for authenticated requests.
@@ -1583,4 +1920,4 @@ declare class MitumbaClient {
1583
1920
  isAuthenticated(): Promise<boolean>;
1584
1921
  }
1585
1922
 
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 };
1923
+ 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 };