@mitumba/sdk 5.12.0 → 5.13.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.mjs CHANGED
@@ -445,7 +445,6 @@ var AuthModule = class {
445
445
  constructor(client) {
446
446
  this.client = client;
447
447
  }
448
- client;
449
448
  /**
450
449
  * Register a new account.
451
450
  * If using EmailRegisterInput, returns AuthTokens (auto-persisted).
@@ -477,11 +476,15 @@ var AuthModule = class {
477
476
  return this.client.post("/auth/otp/send", input, options);
478
477
  }
479
478
  /**
480
- * Verify an OTP code. Tokens are auto-persisted.
479
+ * Verify a phone OTP code.
480
+ *
481
+ * Returns the session tokens (auto-persisted) for an account without a second factor. An account
482
+ * with 2FA gets a `TwoFactorRequired` challenge instead, exactly like `login()`: complete it with
483
+ * `verify2FA()` or the passkey ceremony. Narrow with `'requires_2fa' in result`.
481
484
  */
482
485
  async verifyOtp(input, options) {
483
486
  const result = await this.client.post("/auth/otp/verify", input, options);
484
- await this.client.setSession(result);
487
+ if (isAuthTokens(result)) await this.client.setSession(result);
485
488
  return result;
486
489
  }
487
490
  /**
@@ -699,7 +702,6 @@ var OAuthModule = class {
699
702
  constructor(client) {
700
703
  this.client = client;
701
704
  }
702
- client;
703
705
  /**
704
706
  * Mint a one-time authorization code for the relying party.
705
707
  *
@@ -908,7 +910,6 @@ var ListingsModule = class {
908
910
  constructor(client) {
909
911
  this.client = client;
910
912
  }
911
- client;
912
913
  /**
913
914
  * Browse the marketplace feed with optional filters.
914
915
  */
@@ -1053,7 +1054,6 @@ var SearchModule = class {
1053
1054
  constructor(client) {
1054
1055
  this.client = client;
1055
1056
  }
1056
- client;
1057
1057
  /**
1058
1058
  * Perform a full-text search with optional filters.
1059
1059
  */
@@ -1093,7 +1093,6 @@ var OrdersModule = class {
1093
1093
  constructor(client) {
1094
1094
  this.client = client;
1095
1095
  }
1096
- client;
1097
1096
  /**
1098
1097
  * Create a new order from a listing.
1099
1098
  */
@@ -1129,7 +1128,6 @@ var PayModule = class {
1129
1128
  constructor(client) {
1130
1129
  this.client = client;
1131
1130
  }
1132
- client;
1133
1131
  /**
1134
1132
  * Initiate an M-Pesa STK Push payment for an order.
1135
1133
  */
@@ -1185,7 +1183,6 @@ var VaziModule = class {
1185
1183
  constructor(client) {
1186
1184
  this.client = client;
1187
1185
  }
1188
- client;
1189
1186
  /**
1190
1187
  * Browse the AI-curated outfit feed.
1191
1188
  */
@@ -1314,8 +1311,6 @@ var ManagedMessagesRealtimeConnection = class {
1314
1311
  this.options = options;
1315
1312
  this.currentCursor = options.resumeCursor ?? null;
1316
1313
  }
1317
- client;
1318
- options;
1319
1314
  currentState = "closed";
1320
1315
  currentCursor;
1321
1316
  socket = null;
@@ -1649,7 +1644,6 @@ var MessagesModule = class {
1649
1644
  constructor(client) {
1650
1645
  this.client = client;
1651
1646
  }
1652
- client;
1653
1647
  /**
1654
1648
  * Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
1655
1649
  * a store blocks a buyer (`{ buyer_id }`). Idempotent.
@@ -1835,7 +1829,6 @@ var NotificationsModule = class {
1835
1829
  constructor(client) {
1836
1830
  this.client = client;
1837
1831
  }
1838
- client;
1839
1832
  /**
1840
1833
  * List paginated notifications with unread count.
1841
1834
  */
@@ -1859,7 +1852,6 @@ var StoresModule = class {
1859
1852
  constructor(client) {
1860
1853
  this.client = client;
1861
1854
  }
1862
- client;
1863
1855
  /**
1864
1856
  * Get a store by its URL slug.
1865
1857
  */
@@ -1973,7 +1965,6 @@ var ReviewsModule = class {
1973
1965
  constructor(client) {
1974
1966
  this.client = client;
1975
1967
  }
1976
- client;
1977
1968
  /**
1978
1969
  * List reviews for a store (public).
1979
1970
  */
@@ -2007,7 +1998,6 @@ var WishlistsModule = class {
2007
1998
  constructor(client) {
2008
1999
  this.client = client;
2009
2000
  }
2010
- client;
2011
2001
  /**
2012
2002
  * List saved listings.
2013
2003
  */
@@ -2033,7 +2023,6 @@ var CartModule = class {
2033
2023
  constructor(client) {
2034
2024
  this.client = client;
2035
2025
  }
2036
- client;
2037
2026
  /**
2038
2027
  * List items in the cart.
2039
2028
  */
@@ -2071,7 +2060,6 @@ var SettingsModule = class {
2071
2060
  constructor(client) {
2072
2061
  this.client = client;
2073
2062
  }
2074
- client;
2075
2063
  // ── Profile ──
2076
2064
  async getProfile(options) {
2077
2065
  return this.client.get("/auth/me", void 0, options);
@@ -2204,7 +2192,6 @@ var MailerModule = class {
2204
2192
  constructor(client) {
2205
2193
  this.client = client;
2206
2194
  }
2207
- client;
2208
2195
  /**
2209
2196
  * Send a transactional email via the notifications worker.
2210
2197
  */
@@ -2218,7 +2205,6 @@ var BusinessesModule = class {
2218
2205
  constructor(client) {
2219
2206
  this.client = client;
2220
2207
  }
2221
- client;
2222
2208
  /** Get all businesses owned by the current user. */
2223
2209
  async getMine(options) {
2224
2210
  return this.client.get("/listings/businesses/mine", void 0, options);
@@ -2238,7 +2224,6 @@ var AdminModule = class {
2238
2224
  constructor(client) {
2239
2225
  this.client = client;
2240
2226
  }
2241
- client;
2242
2227
  async blockIp(ip, reasonOrDuration = 24, durationOrOptions, maybeOptions) {
2243
2228
  const modern = typeof reasonOrDuration === "string";
2244
2229
  const reason = modern ? reasonOrDuration : "No reason supplied by legacy SDK caller";
@@ -2442,7 +2427,6 @@ var DisputesModule = class {
2442
2427
  constructor(client) {
2443
2428
  this.client = client;
2444
2429
  }
2445
- client;
2446
2430
  /** Raise a dispute on an order (buyer). */
2447
2431
  async raise(orderId, input, options) {
2448
2432
  return this.client.post(`/orders/${orderId}/dispute`, input, options);
@@ -2490,7 +2474,6 @@ var UploadsModule = class {
2490
2474
  constructor(client) {
2491
2475
  this.client = client;
2492
2476
  }
2493
- client;
2494
2477
  /** Upload a file (avatar, evidence, etc). Returns the public CDN URL. */
2495
2478
  async upload(file, options) {
2496
2479
  const formData = new FormData();
@@ -2504,7 +2487,6 @@ var ReportsModule = class {
2504
2487
  constructor(client) {
2505
2488
  this.client = client;
2506
2489
  }
2507
- client;
2508
2490
  /** Report a listing, review, store, or user for admin review. */
2509
2491
  async create(input, options) {
2510
2492
  return this.client.post("/listings/reports", input, options);
@@ -2516,7 +2498,6 @@ var WholesaleModule = class {
2516
2498
  constructor(client) {
2517
2499
  this.client = client;
2518
2500
  }
2519
- client;
2520
2501
  // ── Wholesale Store ──
2521
2502
  /** Get the current user's wholesale store and depots. */
2522
2503
  async getWholesaleStore(options) {
@@ -2652,7 +2633,6 @@ var IamModule = class {
2652
2633
  constructor(client) {
2653
2634
  this.client = client;
2654
2635
  }
2655
- client;
2656
2636
  /** Start IAM sign-in with an organization ID or alias, email and password. */
2657
2637
  async login(input, options) {
2658
2638
  const result = await this.client.post("/auth/iam/login", input, options);
@@ -2789,7 +2769,6 @@ var MarketsModule = class {
2789
2769
  constructor(client) {
2790
2770
  this.client = client;
2791
2771
  }
2792
- client;
2793
2772
  /**
2794
2773
  * List the platform's markets: the countries Mitumba operates in or plans to, with each
2795
2774
  * market's currency, locale, phone rules, region naming and payment rails.