@mitumba/sdk 5.20.0 → 5.22.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
@@ -3085,6 +3085,29 @@ var DISPUTE_STATUSES = ["open", "seller_responded", "under_review", "resolved_re
3085
3085
  // src/types/wholesale.ts
3086
3086
  var BALE_ORDER_STATUSES = ["pending_payment", "paid", "confirmed", "in_transit", "delivered", "completed", "cancelled"];
3087
3087
 
3088
+ // src/modules/cart-availability.ts
3089
+ function cartLineAvailability(item) {
3090
+ if (item.status === "sold") return "sold";
3091
+ if (item.status !== "active") return "unavailable";
3092
+ if (item.available_quantity <= 0) return "reserved";
3093
+ if (item.available_quantity < item.quantity) return "limited";
3094
+ return "available";
3095
+ }
3096
+ function isCartLineBuyable(item) {
3097
+ const availability = cartLineAvailability(item);
3098
+ return availability === "available" || availability === "limited";
3099
+ }
3100
+ function partitionCart(items) {
3101
+ const partition = { buyable: [], limited: [], unavailable: [] };
3102
+ for (const item of items) {
3103
+ const availability = cartLineAvailability(item);
3104
+ if (availability === "available") partition.buyable.push(item);
3105
+ else if (availability === "limited") partition.limited.push(item);
3106
+ else partition.unavailable.push(item);
3107
+ }
3108
+ return partition;
3109
+ }
3110
+
3088
3111
  // src/markets.ts
3089
3112
  var GAP = " ";
3090
3113
  function group(value, locale) {
@@ -3321,6 +3344,6 @@ var MitumbaClient = class {
3321
3344
  }
3322
3345
  };
3323
3346
 
3324
- export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, CheckoutsModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, 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, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, regionById, storeShareUrl };
3347
+ export { APIClient, APIError, AdminModule, AuthModule, BALE_ORDER_STATUSES, BusinessesModule, CONDITIONS, CartModule, CheckoutsModule, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, DisputesModule, 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, checkoutRefusal, createTokenStore, findMarket, findRegion, formatAmount, formatMoney, formatMoneyCompact, formatPhone, isCartLineBuyable, isConsentRequired, isMessagingAPIError, isValidPhone, listingShareUrl, maskPhone, normalizePhone, partitionCart, regionById, storeShareUrl };
3325
3348
  //# sourceMappingURL=index.mjs.map
3326
3349
  //# sourceMappingURL=index.mjs.map