@mitumba/sdk 5.37.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 {
@@ -3820,6 +3849,7 @@ var BALE_ORDER_STATUSES = ["pending_payment", "paid", "confirmed", "in_transit",
3820
3849
  function cartLineAvailability(item) {
3821
3850
  if (item.status === "sold") return "sold";
3822
3851
  if (item.status !== "active") return "unavailable";
3852
+ if (item.store_accepting_orders === false) return "shop_away";
3823
3853
  if (item.available_quantity <= 0) return "reserved";
3824
3854
  if (item.available_quantity < item.quantity) return "limited";
3825
3855
  return "available";
@@ -4093,6 +4123,6 @@ var MitumbaClient = class {
4093
4123
  }
4094
4124
  };
4095
4125
 
4096
- 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 };
4097
4127
  //# sourceMappingURL=index.mjs.map
4098
4128
  //# sourceMappingURL=index.mjs.map