@mitumba/sdk 1.24.1 → 1.26.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.js CHANGED
@@ -456,6 +456,21 @@ var AuthModule = class {
456
456
  await this.client.clearToken();
457
457
  return result;
458
458
  }
459
+ // ── Passkey Login ──
460
+ /**
461
+ * Start passkey login — get assertion options for navigator.credentials.get().
462
+ */
463
+ async startPasskeyLogin(input, options) {
464
+ return this.client.post("/auth/2fa/login/passkey/start", input, options);
465
+ }
466
+ /**
467
+ * Finish passkey login — submit the browser's assertion response. Tokens are auto-persisted.
468
+ */
469
+ async finishPasskeyLogin(input, options) {
470
+ const result = await this.client.post("/auth/2fa/login/passkey/finish", input, options);
471
+ await this.client.setSession(result);
472
+ return result;
473
+ }
459
474
  };
460
475
 
461
476
  // src/modules/listings.ts
@@ -789,6 +804,15 @@ var MessagesModule = class {
789
804
  const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/${partnerId}/ws?token=${token}`;
790
805
  return new WebSocket(wsUrl);
791
806
  }
807
+ /**
808
+ * Connect to the user-scoped inbox WebSocket.
809
+ * Emits InboxRealtimeEvent for every inbound message across all conversations.
810
+ */
811
+ connectInbox() {
812
+ const token = this.client.getToken();
813
+ const wsUrl = this.client.getBaseUrl().replace(/^http/, "ws") + `/notify/messages/inbox?token=${token}`;
814
+ return new WebSocket(wsUrl);
815
+ }
792
816
  };
793
817
 
794
818
  // src/modules/notifications.ts
@@ -1140,6 +1164,13 @@ var SettingsModule = class {
1140
1164
  async challenge2FAMethod(id, options) {
1141
1165
  return this.client.post(`/auth/2fa/methods/${id}/challenge`, void 0, options);
1142
1166
  }
1167
+ // ── Passkey Registration ──
1168
+ async startPasskeyRegistration(input, options) {
1169
+ return this.client.post("/auth/2fa/methods", { type: "passkey", ...input }, options);
1170
+ }
1171
+ async finishPasskeyRegistration(methodId, credential, options) {
1172
+ return this.client.post(`/auth/2fa/methods/${methodId}/passkey/finish`, credential, options);
1173
+ }
1143
1174
  };
1144
1175
 
1145
1176
  // src/modules/mailer.ts
@@ -1385,8 +1416,63 @@ var ReportsModule = class {
1385
1416
  }
1386
1417
  };
1387
1418
 
1419
+ // src/modules/wholesale.ts
1420
+ var WholesaleModule = class {
1421
+ constructor(client) {
1422
+ this.client = client;
1423
+ }
1424
+ client;
1425
+ // ── Wholesale Store ──
1426
+ /** Get the current user's wholesale store and depots. */
1427
+ async getWholesaleStore(options) {
1428
+ return this.client.get("/listings/wholesale/store", void 0, options);
1429
+ }
1430
+ /** Create or update the wholesale store (bale_seller only). */
1431
+ async saveWholesaleStore(input, options) {
1432
+ return this.client.post("/listings/wholesale/store", input, options);
1433
+ }
1434
+ /** Add a depot to the wholesale store. */
1435
+ async addDepot(input, options) {
1436
+ return this.client.post("/listings/wholesale/store/depots", input, options);
1437
+ }
1438
+ /** Remove a depot. */
1439
+ async removeDepot(id, options) {
1440
+ return this.client.delete(`/listings/wholesale/store/depots/${id}`, void 0, options);
1441
+ }
1442
+ // ── Bales ──
1443
+ /** Create a bale listing (requires verified wholesale store). */
1444
+ async createBale(input, options) {
1445
+ return this.client.post("/listings/bales", input, options);
1446
+ }
1447
+ /** Get a bale by ID (public). */
1448
+ async getBale(id, options) {
1449
+ return this.client.get(`/listings/bales/${id}`, void 0, options);
1450
+ }
1451
+ /** Update a bale. */
1452
+ async updateBale(id, input, options) {
1453
+ return this.client.patch(`/listings/bales/${id}`, input, options);
1454
+ }
1455
+ /** Soft-delete a bale. */
1456
+ async removeBale(id, options) {
1457
+ return this.client.delete(`/listings/bales/${id}`, void 0, options);
1458
+ }
1459
+ /** Get all bales for the current user's wholesale store. */
1460
+ async myBales(options) {
1461
+ return this.client.get("/listings/wholesale/mine/bales", void 0, options);
1462
+ }
1463
+ // ── Feed ──
1464
+ /** Browse the wholesale bale feed (public). */
1465
+ async wholesaleFeed(params, options) {
1466
+ return this.client.get(
1467
+ "/listings/wholesale/feed",
1468
+ params,
1469
+ options
1470
+ );
1471
+ }
1472
+ };
1473
+
1388
1474
  // src/types/auth.ts
1389
- var TWO_FACTOR_METHOD_TYPES = ["totp", "sms", "email"];
1475
+ var TWO_FACTOR_METHOD_TYPES = ["totp", "sms", "email", "passkey"];
1390
1476
 
1391
1477
  // src/types/listings.ts
1392
1478
  var CONDITIONS = ["new", "like_new", "good", "fair"];
@@ -1435,6 +1521,7 @@ var MitumbaClient = class {
1435
1521
  disputes;
1436
1522
  uploads;
1437
1523
  reports;
1524
+ wholesale;
1438
1525
  constructor(config) {
1439
1526
  this.api = new APIClient(config);
1440
1527
  this.auth = new AuthModule(this.api);
@@ -1456,6 +1543,7 @@ var MitumbaClient = class {
1456
1543
  this.disputes = new DisputesModule(this.api);
1457
1544
  this.uploads = new UploadsModule(this.api);
1458
1545
  this.reports = new ReportsModule(this.api);
1546
+ this.wholesale = new WholesaleModule(this.api);
1459
1547
  }
1460
1548
  /**
1461
1549
  * Set the access token for authenticated requests.
@@ -1527,6 +1615,7 @@ exports.StoresModule = StoresModule;
1527
1615
  exports.TWO_FACTOR_METHOD_TYPES = TWO_FACTOR_METHOD_TYPES;
1528
1616
  exports.UploadsModule = UploadsModule;
1529
1617
  exports.VaziModule = VaziModule;
1618
+ exports.WholesaleModule = WholesaleModule;
1530
1619
  exports.WishlistsModule = WishlistsModule;
1531
1620
  exports.createTokenStore = createTokenStore;
1532
1621
  //# sourceMappingURL=index.js.map