@mitumba/sdk 5.34.0 → 5.36.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
@@ -956,19 +956,29 @@ var ListingsModule = class {
956
956
  return this.client.get(`/listings/${id}`, void 0, options);
957
957
  }
958
958
  /**
959
- * Create a new listing (requires seller role).
959
+ * List a piece in a shop, live or as a draft (`status: 'draft'`). Needs `store:listings.manage`
960
+ * in that shop. A draft is seen only by the shop's team until it is published.
961
+ *
962
+ * Errors: 400 invalid_input; 403 store_forbidden, not_a_retail_shop; 404 store_not_found.
960
963
  */
961
964
  async create(input, options) {
962
965
  return this.client.post("/listings", input, options);
963
966
  }
964
967
  /**
965
- * Update an existing listing.
968
+ * Change a piece's details, stock or package size. Sold and removed pieces
969
+ * cannot be edited.
970
+ *
971
+ * Errors: 400 invalid_input, listing_immutable; 403 store_forbidden; 404 not_found.
966
972
  */
967
973
  async update(id, input, options) {
968
974
  return this.client.put(`/listings/${id}`, input, options);
969
975
  }
970
976
  /**
971
- * Change the status of a listing.
977
+ * Change a piece's status. Publishing a draft (`'active'`) needs a title of 3+ letters, a price
978
+ * of at least KES 50 and at least one photo; otherwise 422 `not_ready` whose message names what
979
+ * is missing (see `notReadyToPublish`).
980
+ *
981
+ * Errors: 400 invalid_transition; 403 store_forbidden; 404 not_found; 422 not_ready.
972
982
  */
973
983
  async updateStatus(id, status, options) {
974
984
  return this.client.patch(`/listings/${id}/status`, { status }, options);
@@ -1077,6 +1087,9 @@ var ListingsModule = class {
1077
1087
  );
1078
1088
  }
1079
1089
  };
1090
+ function notReadyToPublish(error) {
1091
+ return error instanceof APIError && error.code === "not_ready";
1092
+ }
1080
1093
 
1081
1094
  // src/modules/search.ts
1082
1095
  var SearchModule = class {
@@ -2371,6 +2384,18 @@ var StoresModule = class {
2371
2384
  async getStats(storeId, options) {
2372
2385
  return this.client.get(`/listings/stores/${storeId}/stats`, void 0, options);
2373
2386
  }
2387
+ /** Where the shop owner's identity verification stands. Owner only (403 otherwise). */
2388
+ async getVerification(storeId, options) {
2389
+ return this.client.get(`/listings/stores/${storeId}/verification`, void 0, options);
2390
+ }
2391
+ /**
2392
+ * Submit an identity document for review: upload it first with `documents.upload` (purpose
2393
+ * `identity_document`, this store). Owner only. 400 `invalid_document` for any other document,
2394
+ * 409 `already_verified` or `no_seller_profile`.
2395
+ */
2396
+ async submitVerification(storeId, documentId, options) {
2397
+ return this.client.post(`/listings/stores/${storeId}/verification`, { document_id: documentId }, options);
2398
+ }
2374
2399
  /**
2375
2400
  * Get store settings.
2376
2401
  */
@@ -2498,6 +2523,16 @@ var StoresModule = class {
2498
2523
  destinationPath(storeId, destinationId, suffix) {
2499
2524
  return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
2500
2525
  }
2526
+ /**
2527
+ * The shop's whole stock for its team: drafts, live, sold and (by filter) removed pieces, most
2528
+ * recently changed first, 24 per page, with counts per status. `store:listings.read`. The public
2529
+ * store page (`getListings`) shows live pieces only.
2530
+ *
2531
+ * Errors: 400 invalid_input; 403 store_forbidden; 404 not_found.
2532
+ */
2533
+ async getInventory(storeId, params, options) {
2534
+ return this.client.get(`/listings/stores/${encodeURIComponent(storeId)}/inventory`, params, options);
2535
+ }
2501
2536
  // ── Team ──────────────────────────────────────────────────────────────────
2502
2537
  /**
2503
2538
  * The shop's members, and the roles the caller may give. `store:members.manage`.
@@ -3001,8 +3036,12 @@ var AdminModule = class {
3001
3036
  async approveVerification(userId, options) {
3002
3037
  return this.client.post(`/admin/verifications/${userId}/approve`, void 0, options);
3003
3038
  }
3039
+ /**
3040
+ * Reject a seller's verification. `reason` (1–500 characters) is required and shown to the seller.
3041
+ * 409 `already_decided` when already rejected.
3042
+ */
3004
3043
  async rejectVerification(userId, reason, options) {
3005
- return this.client.post(`/admin/verifications/${userId}/reject`, reason ? { reason } : void 0, options);
3044
+ return this.client.post(`/admin/verifications/${userId}/reject`, { reason }, options);
3006
3045
  }
3007
3046
  // ── STI ──
3008
3047
  async adjustSti(userId, input, options) {
@@ -3736,6 +3775,7 @@ var TWO_FACTOR_METHOD_TYPES = ["totp", "sms", "email", "passkey"];
3736
3775
  // src/types/listings.ts
3737
3776
  var CONDITIONS = ["new", "like_new", "good", "fair"];
3738
3777
  var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
3778
+ var PACKAGE_SIZES = ["small", "medium", "large", "oversize"];
3739
3779
 
3740
3780
  // src/types/orders.ts
3741
3781
  var ORDER_STATUSES = [
@@ -3753,6 +3793,9 @@ var ORDER_STATUSES = [
3753
3793
  // src/types/pay.ts
3754
3794
  var PAYMENT_STATUSES = ["initiated", "funded", "failed", "refunded", "cancelled"];
3755
3795
 
3796
+ // src/types/stores.ts
3797
+ var SELLER_VERIFICATION_STATUSES = ["unverified", "pending", "verified", "rejected"];
3798
+
3756
3799
  // src/types/disputes.ts
3757
3800
  var DISPUTE_REASONS = ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
3758
3801
  var DESIRED_RESOLUTIONS = ["refund", "replacement", "partial_refund"];
@@ -4041,6 +4084,6 @@ var MitumbaClient = class {
4041
4084
  }
4042
4085
  };
4043
4086
 
4044
- export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, CheckoutsModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DOCUMENT_PURPOSES, DisputesModule, DocumentsModule, IDBTokenStore, IamModule, LISTING_STATUSES, ListingsModule, MailerModule, MarketsModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isDocumentId, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, stepUpRequired, storeShareUrl };
4087
+ export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, CheckoutsModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DOCUMENT_PURPOSES, DisputesModule, DocumentsModule, IDBTokenStore, IamModule, LISTING_STATUSES, ListingsModule, MailerModule, MarketsModule, MemoryTokenStore, MessagesModule, MitumbaClient, NotificationsModule, OAuthModule, ORDER_STATUSES, OrdersModule, PACKAGE_SIZES, PAYMENT_STATUSES, PayModule, RealtimeProtocolError, RealtimeUnavailableError, ReportsModule, ReviewsModule, SELLER_VERIFICATION_STATUSES, SearchModule, SettingsModule, StoresModule, TWO_FACTOR_METHOD_TYPES, UploadsModule, VaziModule, WholesaleModule, WishlistsModule, activeMarkets, baleShareUrl, cartLineAvailability, categoriesBySection, categorySection, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConditionAllowed, isConsentRequired, isDocumentId, isMessagingAPIError, isNewOnlyCategory, isValidPhone, listingShareUrl, maskPhone, normalizePhone, notReadyToPublish, partitionCart, regionById, stepUpRequired, storeShareUrl };
4045
4088
  //# sourceMappingURL=index.mjs.map
4046
4089
  //# sourceMappingURL=index.mjs.map