@mitumba/sdk 5.12.0 → 5.14.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";
@@ -2396,6 +2381,47 @@ var AdminModule = class {
2396
2381
  async listAuditLog(query2 = {}, options) {
2397
2382
  return this.client.get("/admin/audit", query2, options);
2398
2383
  }
2384
+ // ── Identity provider: sign-in clients (requires clients:manage) ──
2385
+ /** Every registered sign-in client, oldest first. Secrets are never included. */
2386
+ async listOAuthClients(options) {
2387
+ return this.client.get("/admin/clients", void 0, options);
2388
+ }
2389
+ /** One client with its redirect-URI allow-list and permitted scopes. */
2390
+ async getOAuthClient(clientId, options) {
2391
+ return this.client.get(`/admin/clients/${encodeURIComponent(clientId)}`, void 0, options);
2392
+ }
2393
+ /**
2394
+ * Register a client. A confidential client's `client_secret` is in this response only — it is
2395
+ * stored hashed and cannot be retrieved again, so hand it to the client's owner immediately.
2396
+ */
2397
+ async registerOAuthClient(input, options) {
2398
+ return this.client.post("/admin/clients", input, options);
2399
+ }
2400
+ /** Stop a client authorising. Clients are deactivated, never deleted, so their history stays auditable. */
2401
+ async deactivateOAuthClient(clientId, options) {
2402
+ return this.client.post(`/admin/clients/${encodeURIComponent(clientId)}/deactivate`, void 0, options);
2403
+ }
2404
+ /** Replace a client's whole redirect-URI allow-list. URIs match exactly: no wildcards or prefixes. */
2405
+ async setOAuthClientRedirectUris(clientId, redirectUris, options) {
2406
+ return this.client.put(`/admin/clients/${encodeURIComponent(clientId)}/redirect-uris`, { redirect_uris: redirectUris }, options);
2407
+ }
2408
+ /** Replace the set of scopes a client may request. */
2409
+ async setOAuthClientScopes(clientId, scopes, options) {
2410
+ return this.client.put(`/admin/clients/${encodeURIComponent(clientId)}/scopes`, { scopes }, options);
2411
+ }
2412
+ // ── Identity provider: signing keys (requires oidc:rotate_keys) ──
2413
+ /** The signing-key window — current, previous, retired — as metadata only. */
2414
+ async listOidcSigningKeys(options) {
2415
+ return this.client.get("/auth/oidc/keys", void 0, options);
2416
+ }
2417
+ /**
2418
+ * Run the rotation ceremony: a new key becomes current, the current key becomes previous (still
2419
+ * verifying), and the old previous is retired. Do not rotate twice within an id_token lifetime
2420
+ * (one hour), or tokens signed by the retired key stop verifying.
2421
+ */
2422
+ async rotateOidcSigningKey(options) {
2423
+ return this.client.post("/auth/oidc/keys/rotate", void 0, options);
2424
+ }
2399
2425
  // ── Payout approval ──
2400
2426
  async listPayoutsAwaitingApproval(options) {
2401
2427
  return this.client.get("/admin/payouts/pending-approval", void 0, options);
@@ -2442,7 +2468,6 @@ var DisputesModule = class {
2442
2468
  constructor(client) {
2443
2469
  this.client = client;
2444
2470
  }
2445
- client;
2446
2471
  /** Raise a dispute on an order (buyer). */
2447
2472
  async raise(orderId, input, options) {
2448
2473
  return this.client.post(`/orders/${orderId}/dispute`, input, options);
@@ -2490,7 +2515,6 @@ var UploadsModule = class {
2490
2515
  constructor(client) {
2491
2516
  this.client = client;
2492
2517
  }
2493
- client;
2494
2518
  /** Upload a file (avatar, evidence, etc). Returns the public CDN URL. */
2495
2519
  async upload(file, options) {
2496
2520
  const formData = new FormData();
@@ -2504,7 +2528,6 @@ var ReportsModule = class {
2504
2528
  constructor(client) {
2505
2529
  this.client = client;
2506
2530
  }
2507
- client;
2508
2531
  /** Report a listing, review, store, or user for admin review. */
2509
2532
  async create(input, options) {
2510
2533
  return this.client.post("/listings/reports", input, options);
@@ -2516,7 +2539,6 @@ var WholesaleModule = class {
2516
2539
  constructor(client) {
2517
2540
  this.client = client;
2518
2541
  }
2519
- client;
2520
2542
  // ── Wholesale Store ──
2521
2543
  /** Get the current user's wholesale store and depots. */
2522
2544
  async getWholesaleStore(options) {
@@ -2652,7 +2674,6 @@ var IamModule = class {
2652
2674
  constructor(client) {
2653
2675
  this.client = client;
2654
2676
  }
2655
- client;
2656
2677
  /** Start IAM sign-in with an organization ID or alias, email and password. */
2657
2678
  async login(input, options) {
2658
2679
  const result = await this.client.post("/auth/iam/login", input, options);
@@ -2789,7 +2810,6 @@ var MarketsModule = class {
2789
2810
  constructor(client) {
2790
2811
  this.client = client;
2791
2812
  }
2792
- client;
2793
2813
  /**
2794
2814
  * List the platform's markets: the countries Mitumba operates in or plans to, with each
2795
2815
  * market's currency, locale, phone rules, region naming and payment rails.