@mitumba/sdk 5.35.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 {
@@ -2510,6 +2523,16 @@ var StoresModule = class {
2510
2523
  destinationPath(storeId, destinationId, suffix) {
2511
2524
  return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
2512
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
+ }
2513
2536
  // ── Team ──────────────────────────────────────────────────────────────────
2514
2537
  /**
2515
2538
  * The shop's members, and the roles the caller may give. `store:members.manage`.
@@ -3752,6 +3775,7 @@ var TWO_FACTOR_METHOD_TYPES = ["totp", "sms", "email", "passkey"];
3752
3775
  // src/types/listings.ts
3753
3776
  var CONDITIONS = ["new", "like_new", "good", "fair"];
3754
3777
  var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
3778
+ var PACKAGE_SIZES = ["small", "medium", "large", "oversize"];
3755
3779
 
3756
3780
  // src/types/orders.ts
3757
3781
  var ORDER_STATUSES = [
@@ -4060,6 +4084,6 @@ var MitumbaClient = class {
4060
4084
  }
4061
4085
  };
4062
4086
 
4063
- 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, 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, 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 };
4064
4088
  //# sourceMappingURL=index.mjs.map
4065
4089
  //# sourceMappingURL=index.mjs.map