@mitumba/sdk 5.36.0 → 5.38.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
@@ -2533,6 +2533,28 @@ var StoresModule = class {
2533
2533
  async getInventory(storeId, params, options) {
2534
2534
  return this.client.get(`/listings/stores/${encodeURIComponent(storeId)}/inventory`, params, options);
2535
2535
  }
2536
+ /**
2537
+ * The shop's away state, and how many orders still need it. `store:settings.manage`.
2538
+ *
2539
+ * Errors: 403 store_forbidden; 404 not_found.
2540
+ */
2541
+ async getAway(storeId, options) {
2542
+ return this.client.get(`/listings/stores/${encodeURIComponent(storeId)}/away`, void 0, options);
2543
+ }
2544
+ /**
2545
+ * Go away until `until` (an ISO date-time at most 30 days ahead). The shop takes no new orders
2546
+ * until then, and comes back by itself. Only with no open orders. `store:settings.manage`.
2547
+ *
2548
+ * Errors: 400 invalid_input, invalid_away_date; 403 store_forbidden; 404 not_found;
2549
+ * 409 store_has_open_orders (`body.open_orders`).
2550
+ */
2551
+ async setAway(storeId, until, options) {
2552
+ return this.client.put(`/listings/stores/${encodeURIComponent(storeId)}/away`, { until }, options);
2553
+ }
2554
+ /** Come back before the return date. Nothing changes for a shop that is not away. `store:settings.manage`. */
2555
+ async returnFromAway(storeId, options) {
2556
+ return this.client.delete(`/listings/stores/${encodeURIComponent(storeId)}/away`, void 0, options);
2557
+ }
2536
2558
  // ── Team ──────────────────────────────────────────────────────────────────
2537
2559
  /**
2538
2560
  * The shop's members, and the roles the caller may give. `store:members.manage`.
@@ -2643,6 +2665,13 @@ var StoresModule = class {
2643
2665
  function stepUpRequired(error) {
2644
2666
  return error instanceof APIError && error.code === "step_up_required";
2645
2667
  }
2668
+ function shopsNotTakingOrders(error) {
2669
+ if (!(error instanceof APIError) || error.code !== "store_away" && error.code !== "store_paused") return [];
2670
+ const body = error.body ?? {};
2671
+ if (Array.isArray(body.stores)) return body.stores.map((shop) => ({ store_id: shop.store_id, reason: shop.reason, until: shop.until }));
2672
+ const reason = error.code;
2673
+ return [{ store_id: body.store_id ?? null, reason, until: (reason === "store_away" ? body.away_until : body.paused_until) ?? null }];
2674
+ }
2646
2675
 
2647
2676
  // src/modules/reviews.ts
2648
2677
  var ReviewsModule = class {
@@ -3107,6 +3136,15 @@ var AdminModule = class {
3107
3136
  async listShopLimitRequests(params, options) {
3108
3137
  return this.client.get("/admin/shop-limit-requests", params, options);
3109
3138
  }
3139
+ /**
3140
+ * A shop's active members and one page of its audit log, 50 entries newest first, closed shops
3141
+ * included. `admin:read`.
3142
+ *
3143
+ * Errors: 403 forbidden; 404 not_found.
3144
+ */
3145
+ async getShopTeam(storeId, params, options) {
3146
+ return this.client.get(`/admin/stores/${encodeURIComponent(storeId)}/team`, params, options);
3147
+ }
3110
3148
  /**
3111
3149
  * Approve a request with a new limit (above the current one, at most 50), or reject it with a note
3112
3150
  * of at least 10 characters. The owner is told. `sellers:verify`.
@@ -3811,6 +3849,7 @@ var BALE_ORDER_STATUSES = ["pending_payment", "paid", "confirmed", "in_transit",
3811
3849
  function cartLineAvailability(item) {
3812
3850
  if (item.status === "sold") return "sold";
3813
3851
  if (item.status !== "active") return "unavailable";
3852
+ if (item.store_accepting_orders === false) return "shop_away";
3814
3853
  if (item.available_quantity <= 0) return "reserved";
3815
3854
  if (item.available_quantity < item.quantity) return "limited";
3816
3855
  return "available";
@@ -4084,6 +4123,6 @@ var MitumbaClient = class {
4084
4123
  }
4085
4124
  };
4086
4125
 
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 };
4126
+ 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, shopsNotTakingOrders, stepUpRequired, storeShareUrl };
4088
4127
  //# sourceMappingURL=index.mjs.map
4089
4128
  //# sourceMappingURL=index.mjs.map