@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.d.mts CHANGED
@@ -1413,6 +1413,12 @@ interface OAuthAuthorizeInput {
1413
1413
  state: string;
1414
1414
  /** The PKCE code challenge (base64url SHA-256 of the verifier). */
1415
1415
  code_challenge: string;
1416
+ /**
1417
+ * The OpenID Connect `nonce` from the relying party's authentication request. Carried to the
1418
+ * one-time code and echoed in the id_token's `nonce` claim, so the relying party can bind the
1419
+ * id_token to its own request and reject a replayed one. Pass it whenever the relying party sent it.
1420
+ */
1421
+ nonce?: string;
1416
1422
  }
1417
1423
  /**
1418
1424
  * Result of the authorize (mint) step: a one-time authorization code plus the echoed state.
@@ -2970,9 +2976,13 @@ declare class AuthModule {
2970
2976
  */
2971
2977
  sendOtp(input: SendOtpInput, options?: RequestOptions): Promise<MessageResponse>;
2972
2978
  /**
2973
- * Verify an OTP code. Tokens are auto-persisted.
2979
+ * Verify a phone OTP code.
2980
+ *
2981
+ * Returns the session tokens (auto-persisted) for an account without a second factor. An account
2982
+ * with 2FA gets a `TwoFactorRequired` challenge instead, exactly like `login()`: complete it with
2983
+ * `verify2FA()` or the passkey ceremony. Narrow with `'requires_2fa' in result`.
2974
2984
  */
2975
- verifyOtp(input: VerifyOtpInput, options?: RequestOptions): Promise<AuthTokens>;
2985
+ verifyOtp(input: VerifyOtpInput, options?: RequestOptions): Promise<AuthTokens | TwoFactorRequired>;
2976
2986
  /**
2977
2987
  * Refresh the access token using a refresh token.
2978
2988
  */
package/dist/index.d.ts CHANGED
@@ -1413,6 +1413,12 @@ interface OAuthAuthorizeInput {
1413
1413
  state: string;
1414
1414
  /** The PKCE code challenge (base64url SHA-256 of the verifier). */
1415
1415
  code_challenge: string;
1416
+ /**
1417
+ * The OpenID Connect `nonce` from the relying party's authentication request. Carried to the
1418
+ * one-time code and echoed in the id_token's `nonce` claim, so the relying party can bind the
1419
+ * id_token to its own request and reject a replayed one. Pass it whenever the relying party sent it.
1420
+ */
1421
+ nonce?: string;
1416
1422
  }
1417
1423
  /**
1418
1424
  * Result of the authorize (mint) step: a one-time authorization code plus the echoed state.
@@ -2970,9 +2976,13 @@ declare class AuthModule {
2970
2976
  */
2971
2977
  sendOtp(input: SendOtpInput, options?: RequestOptions): Promise<MessageResponse>;
2972
2978
  /**
2973
- * Verify an OTP code. Tokens are auto-persisted.
2979
+ * Verify a phone OTP code.
2980
+ *
2981
+ * Returns the session tokens (auto-persisted) for an account without a second factor. An account
2982
+ * with 2FA gets a `TwoFactorRequired` challenge instead, exactly like `login()`: complete it with
2983
+ * `verify2FA()` or the passkey ceremony. Narrow with `'requires_2fa' in result`.
2974
2984
  */
2975
- verifyOtp(input: VerifyOtpInput, options?: RequestOptions): Promise<AuthTokens>;
2985
+ verifyOtp(input: VerifyOtpInput, options?: RequestOptions): Promise<AuthTokens | TwoFactorRequired>;
2976
2986
  /**
2977
2987
  * Refresh the access token using a refresh token.
2978
2988
  */
package/dist/index.js CHANGED
@@ -447,7 +447,6 @@ var AuthModule = class {
447
447
  constructor(client) {
448
448
  this.client = client;
449
449
  }
450
- client;
451
450
  /**
452
451
  * Register a new account.
453
452
  * If using EmailRegisterInput, returns AuthTokens (auto-persisted).
@@ -479,11 +478,15 @@ var AuthModule = class {
479
478
  return this.client.post("/auth/otp/send", input, options);
480
479
  }
481
480
  /**
482
- * Verify an OTP code. Tokens are auto-persisted.
481
+ * Verify a phone OTP code.
482
+ *
483
+ * Returns the session tokens (auto-persisted) for an account without a second factor. An account
484
+ * with 2FA gets a `TwoFactorRequired` challenge instead, exactly like `login()`: complete it with
485
+ * `verify2FA()` or the passkey ceremony. Narrow with `'requires_2fa' in result`.
483
486
  */
484
487
  async verifyOtp(input, options) {
485
488
  const result = await this.client.post("/auth/otp/verify", input, options);
486
- await this.client.setSession(result);
489
+ if (isAuthTokens(result)) await this.client.setSession(result);
487
490
  return result;
488
491
  }
489
492
  /**
@@ -701,7 +704,6 @@ var OAuthModule = class {
701
704
  constructor(client) {
702
705
  this.client = client;
703
706
  }
704
- client;
705
707
  /**
706
708
  * Mint a one-time authorization code for the relying party.
707
709
  *
@@ -910,7 +912,6 @@ var ListingsModule = class {
910
912
  constructor(client) {
911
913
  this.client = client;
912
914
  }
913
- client;
914
915
  /**
915
916
  * Browse the marketplace feed with optional filters.
916
917
  */
@@ -1055,7 +1056,6 @@ var SearchModule = class {
1055
1056
  constructor(client) {
1056
1057
  this.client = client;
1057
1058
  }
1058
- client;
1059
1059
  /**
1060
1060
  * Perform a full-text search with optional filters.
1061
1061
  */
@@ -1095,7 +1095,6 @@ var OrdersModule = class {
1095
1095
  constructor(client) {
1096
1096
  this.client = client;
1097
1097
  }
1098
- client;
1099
1098
  /**
1100
1099
  * Create a new order from a listing.
1101
1100
  */
@@ -1131,7 +1130,6 @@ var PayModule = class {
1131
1130
  constructor(client) {
1132
1131
  this.client = client;
1133
1132
  }
1134
- client;
1135
1133
  /**
1136
1134
  * Initiate an M-Pesa STK Push payment for an order.
1137
1135
  */
@@ -1187,7 +1185,6 @@ var VaziModule = class {
1187
1185
  constructor(client) {
1188
1186
  this.client = client;
1189
1187
  }
1190
- client;
1191
1188
  /**
1192
1189
  * Browse the AI-curated outfit feed.
1193
1190
  */
@@ -1316,8 +1313,6 @@ var ManagedMessagesRealtimeConnection = class {
1316
1313
  this.options = options;
1317
1314
  this.currentCursor = options.resumeCursor ?? null;
1318
1315
  }
1319
- client;
1320
- options;
1321
1316
  currentState = "closed";
1322
1317
  currentCursor;
1323
1318
  socket = null;
@@ -1651,7 +1646,6 @@ var MessagesModule = class {
1651
1646
  constructor(client) {
1652
1647
  this.client = client;
1653
1648
  }
1654
- client;
1655
1649
  /**
1656
1650
  * Create a bilateral block from a v2 inbox perspective. A buyer blocks a store (`{ store_id }`);
1657
1651
  * a store blocks a buyer (`{ buyer_id }`). Idempotent.
@@ -1837,7 +1831,6 @@ var NotificationsModule = class {
1837
1831
  constructor(client) {
1838
1832
  this.client = client;
1839
1833
  }
1840
- client;
1841
1834
  /**
1842
1835
  * List paginated notifications with unread count.
1843
1836
  */
@@ -1861,7 +1854,6 @@ var StoresModule = class {
1861
1854
  constructor(client) {
1862
1855
  this.client = client;
1863
1856
  }
1864
- client;
1865
1857
  /**
1866
1858
  * Get a store by its URL slug.
1867
1859
  */
@@ -1975,7 +1967,6 @@ var ReviewsModule = class {
1975
1967
  constructor(client) {
1976
1968
  this.client = client;
1977
1969
  }
1978
- client;
1979
1970
  /**
1980
1971
  * List reviews for a store (public).
1981
1972
  */
@@ -2009,7 +2000,6 @@ var WishlistsModule = class {
2009
2000
  constructor(client) {
2010
2001
  this.client = client;
2011
2002
  }
2012
- client;
2013
2003
  /**
2014
2004
  * List saved listings.
2015
2005
  */
@@ -2035,7 +2025,6 @@ var CartModule = class {
2035
2025
  constructor(client) {
2036
2026
  this.client = client;
2037
2027
  }
2038
- client;
2039
2028
  /**
2040
2029
  * List items in the cart.
2041
2030
  */
@@ -2073,7 +2062,6 @@ var SettingsModule = class {
2073
2062
  constructor(client) {
2074
2063
  this.client = client;
2075
2064
  }
2076
- client;
2077
2065
  // ── Profile ──
2078
2066
  async getProfile(options) {
2079
2067
  return this.client.get("/auth/me", void 0, options);
@@ -2206,7 +2194,6 @@ var MailerModule = class {
2206
2194
  constructor(client) {
2207
2195
  this.client = client;
2208
2196
  }
2209
- client;
2210
2197
  /**
2211
2198
  * Send a transactional email via the notifications worker.
2212
2199
  */
@@ -2220,7 +2207,6 @@ var BusinessesModule = class {
2220
2207
  constructor(client) {
2221
2208
  this.client = client;
2222
2209
  }
2223
- client;
2224
2210
  /** Get all businesses owned by the current user. */
2225
2211
  async getMine(options) {
2226
2212
  return this.client.get("/listings/businesses/mine", void 0, options);
@@ -2240,7 +2226,6 @@ var AdminModule = class {
2240
2226
  constructor(client) {
2241
2227
  this.client = client;
2242
2228
  }
2243
- client;
2244
2229
  async blockIp(ip, reasonOrDuration = 24, durationOrOptions, maybeOptions) {
2245
2230
  const modern = typeof reasonOrDuration === "string";
2246
2231
  const reason = modern ? reasonOrDuration : "No reason supplied by legacy SDK caller";
@@ -2444,7 +2429,6 @@ var DisputesModule = class {
2444
2429
  constructor(client) {
2445
2430
  this.client = client;
2446
2431
  }
2447
- client;
2448
2432
  /** Raise a dispute on an order (buyer). */
2449
2433
  async raise(orderId, input, options) {
2450
2434
  return this.client.post(`/orders/${orderId}/dispute`, input, options);
@@ -2492,7 +2476,6 @@ var UploadsModule = class {
2492
2476
  constructor(client) {
2493
2477
  this.client = client;
2494
2478
  }
2495
- client;
2496
2479
  /** Upload a file (avatar, evidence, etc). Returns the public CDN URL. */
2497
2480
  async upload(file, options) {
2498
2481
  const formData = new FormData();
@@ -2506,7 +2489,6 @@ var ReportsModule = class {
2506
2489
  constructor(client) {
2507
2490
  this.client = client;
2508
2491
  }
2509
- client;
2510
2492
  /** Report a listing, review, store, or user for admin review. */
2511
2493
  async create(input, options) {
2512
2494
  return this.client.post("/listings/reports", input, options);
@@ -2518,7 +2500,6 @@ var WholesaleModule = class {
2518
2500
  constructor(client) {
2519
2501
  this.client = client;
2520
2502
  }
2521
- client;
2522
2503
  // ── Wholesale Store ──
2523
2504
  /** Get the current user's wholesale store and depots. */
2524
2505
  async getWholesaleStore(options) {
@@ -2654,7 +2635,6 @@ var IamModule = class {
2654
2635
  constructor(client) {
2655
2636
  this.client = client;
2656
2637
  }
2657
- client;
2658
2638
  /** Start IAM sign-in with an organization ID or alias, email and password. */
2659
2639
  async login(input, options) {
2660
2640
  const result = await this.client.post("/auth/iam/login", input, options);
@@ -2791,7 +2771,6 @@ var MarketsModule = class {
2791
2771
  constructor(client) {
2792
2772
  this.client = client;
2793
2773
  }
2794
- client;
2795
2774
  /**
2796
2775
  * List the platform's markets: the countries Mitumba operates in or plans to, with each
2797
2776
  * market's currency, locale, phone rules, region naming and payment rails.