@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.js CHANGED
@@ -958,19 +958,29 @@ var ListingsModule = class {
958
958
  return this.client.get(`/listings/${id}`, void 0, options);
959
959
  }
960
960
  /**
961
- * Create a new listing (requires seller role).
961
+ * List a piece in a shop, live or as a draft (`status: 'draft'`). Needs `store:listings.manage`
962
+ * in that shop. A draft is seen only by the shop's team until it is published.
963
+ *
964
+ * Errors: 400 invalid_input; 403 store_forbidden, not_a_retail_shop; 404 store_not_found.
962
965
  */
963
966
  async create(input, options) {
964
967
  return this.client.post("/listings", input, options);
965
968
  }
966
969
  /**
967
- * Update an existing listing.
970
+ * Change a piece's details, stock or package size. Sold and removed pieces
971
+ * cannot be edited.
972
+ *
973
+ * Errors: 400 invalid_input, listing_immutable; 403 store_forbidden; 404 not_found.
968
974
  */
969
975
  async update(id, input, options) {
970
976
  return this.client.put(`/listings/${id}`, input, options);
971
977
  }
972
978
  /**
973
- * Change the status of a listing.
979
+ * Change a piece's status. Publishing a draft (`'active'`) needs a title of 3+ letters, a price
980
+ * of at least KES 50 and at least one photo; otherwise 422 `not_ready` whose message names what
981
+ * is missing (see `notReadyToPublish`).
982
+ *
983
+ * Errors: 400 invalid_transition; 403 store_forbidden; 404 not_found; 422 not_ready.
974
984
  */
975
985
  async updateStatus(id, status, options) {
976
986
  return this.client.patch(`/listings/${id}/status`, { status }, options);
@@ -1079,6 +1089,9 @@ var ListingsModule = class {
1079
1089
  );
1080
1090
  }
1081
1091
  };
1092
+ function notReadyToPublish(error) {
1093
+ return error instanceof APIError && error.code === "not_ready";
1094
+ }
1082
1095
 
1083
1096
  // src/modules/search.ts
1084
1097
  var SearchModule = class {
@@ -2373,6 +2386,18 @@ var StoresModule = class {
2373
2386
  async getStats(storeId, options) {
2374
2387
  return this.client.get(`/listings/stores/${storeId}/stats`, void 0, options);
2375
2388
  }
2389
+ /** Where the shop owner's identity verification stands. Owner only (403 otherwise). */
2390
+ async getVerification(storeId, options) {
2391
+ return this.client.get(`/listings/stores/${storeId}/verification`, void 0, options);
2392
+ }
2393
+ /**
2394
+ * Submit an identity document for review: upload it first with `documents.upload` (purpose
2395
+ * `identity_document`, this store). Owner only. 400 `invalid_document` for any other document,
2396
+ * 409 `already_verified` or `no_seller_profile`.
2397
+ */
2398
+ async submitVerification(storeId, documentId, options) {
2399
+ return this.client.post(`/listings/stores/${storeId}/verification`, { document_id: documentId }, options);
2400
+ }
2376
2401
  /**
2377
2402
  * Get store settings.
2378
2403
  */
@@ -2500,6 +2525,16 @@ var StoresModule = class {
2500
2525
  destinationPath(storeId, destinationId, suffix) {
2501
2526
  return `/listings/stores/${encodeURIComponent(storeId)}/payout-destinations/${encodeURIComponent(destinationId)}${suffix}`;
2502
2527
  }
2528
+ /**
2529
+ * The shop's whole stock for its team: drafts, live, sold and (by filter) removed pieces, most
2530
+ * recently changed first, 24 per page, with counts per status. `store:listings.read`. The public
2531
+ * store page (`getListings`) shows live pieces only.
2532
+ *
2533
+ * Errors: 400 invalid_input; 403 store_forbidden; 404 not_found.
2534
+ */
2535
+ async getInventory(storeId, params, options) {
2536
+ return this.client.get(`/listings/stores/${encodeURIComponent(storeId)}/inventory`, params, options);
2537
+ }
2503
2538
  // ── Team ──────────────────────────────────────────────────────────────────
2504
2539
  /**
2505
2540
  * The shop's members, and the roles the caller may give. `store:members.manage`.
@@ -3003,8 +3038,12 @@ var AdminModule = class {
3003
3038
  async approveVerification(userId, options) {
3004
3039
  return this.client.post(`/admin/verifications/${userId}/approve`, void 0, options);
3005
3040
  }
3041
+ /**
3042
+ * Reject a seller's verification. `reason` (1–500 characters) is required and shown to the seller.
3043
+ * 409 `already_decided` when already rejected.
3044
+ */
3006
3045
  async rejectVerification(userId, reason, options) {
3007
- return this.client.post(`/admin/verifications/${userId}/reject`, reason ? { reason } : void 0, options);
3046
+ return this.client.post(`/admin/verifications/${userId}/reject`, { reason }, options);
3008
3047
  }
3009
3048
  // ── STI ──
3010
3049
  async adjustSti(userId, input, options) {
@@ -3738,6 +3777,7 @@ var TWO_FACTOR_METHOD_TYPES = ["totp", "sms", "email", "passkey"];
3738
3777
  // src/types/listings.ts
3739
3778
  var CONDITIONS = ["new", "like_new", "good", "fair"];
3740
3779
  var LISTING_STATUSES = ["draft", "active", "sold", "removed"];
3780
+ var PACKAGE_SIZES = ["small", "medium", "large", "oversize"];
3741
3781
 
3742
3782
  // src/types/orders.ts
3743
3783
  var ORDER_STATUSES = [
@@ -3755,6 +3795,9 @@ var ORDER_STATUSES = [
3755
3795
  // src/types/pay.ts
3756
3796
  var PAYMENT_STATUSES = ["initiated", "funded", "failed", "refunded", "cancelled"];
3757
3797
 
3798
+ // src/types/stores.ts
3799
+ var SELLER_VERIFICATION_STATUSES = ["unverified", "pending", "verified", "rejected"];
3800
+
3758
3801
  // src/types/disputes.ts
3759
3802
  var DISPUTE_REASONS = ["not_received", "not_as_described", "damaged", "counterfeit", "wrong_item"];
3760
3803
  var DESIRED_RESOLUTIONS = ["refund", "replacement", "partial_refund"];
@@ -4072,12 +4115,14 @@ exports.NotificationsModule = NotificationsModule;
4072
4115
  exports.OAuthModule = OAuthModule;
4073
4116
  exports.ORDER_STATUSES = ORDER_STATUSES;
4074
4117
  exports.OrdersModule = OrdersModule;
4118
+ exports.PACKAGE_SIZES = PACKAGE_SIZES;
4075
4119
  exports.PAYMENT_STATUSES = PAYMENT_STATUSES;
4076
4120
  exports.PayModule = PayModule;
4077
4121
  exports.RealtimeProtocolError = RealtimeProtocolError;
4078
4122
  exports.RealtimeUnavailableError = RealtimeUnavailableError;
4079
4123
  exports.ReportsModule = ReportsModule;
4080
4124
  exports.ReviewsModule = ReviewsModule;
4125
+ exports.SELLER_VERIFICATION_STATUSES = SELLER_VERIFICATION_STATUSES;
4081
4126
  exports.SearchModule = SearchModule;
4082
4127
  exports.SettingsModule = SettingsModule;
4083
4128
  exports.StoresModule = StoresModule;
@@ -4109,6 +4154,7 @@ exports.isValidPhone = isValidPhone;
4109
4154
  exports.listingShareUrl = listingShareUrl;
4110
4155
  exports.maskPhone = maskPhone;
4111
4156
  exports.normalizePhone = normalizePhone;
4157
+ exports.notReadyToPublish = notReadyToPublish;
4112
4158
  exports.partitionCart = partitionCart;
4113
4159
  exports.regionById = regionById;
4114
4160
  exports.stepUpRequired = stepUpRequired;