@mitumba/sdk 1.30.0 → 1.31.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.d.mts CHANGED
@@ -248,6 +248,9 @@ interface PendingPayoutApproval {
248
248
  dispute_count: number;
249
249
  prior_payouts: number;
250
250
  active_restrictions: number;
251
+ /** Present once a finance operator has approved it; item stays in the queue until disbursed. */
252
+ approved_at: string | null;
253
+ approved_by: string | null;
251
254
  hold_reason: string | null;
252
255
  held_at: string | null;
253
256
  }
@@ -2679,6 +2682,28 @@ declare class WholesaleModule {
2679
2682
  }>;
2680
2683
  }
2681
2684
 
2685
+ /**
2686
+ * Canonical go.mitumba.africa share URLs — the one place clients build listing, store and bale share links.
2687
+ *
2688
+ * Forms follow Mitumba-Ltd/mitumba-links `docs/product/share-urls.md`: `/l/{listingId}`, `/s/{storeSlug}` and
2689
+ * `/b/{baleId}` with no slug, query or fragment. Pure functions: no network access, safe in any runtime.
2690
+ */
2691
+ declare const DEFAULT_SHARE_ORIGIN = "https://go.mitumba.africa";
2692
+ interface ShareUrlOptions {
2693
+ /**
2694
+ * Override the share origin, e.g. a staging Worker. Must be an `https://` origin (no path, query or
2695
+ * credentials); `http://localhost` / `http://127.0.0.1` are allowed for local development.
2696
+ * Defaults to {@link DEFAULT_SHARE_ORIGIN}.
2697
+ */
2698
+ origin?: string;
2699
+ }
2700
+ /** `https://go.mitumba.africa/l/{listingId}` */
2701
+ declare function listingShareUrl(listingId: string, options?: ShareUrlOptions): string;
2702
+ /** `https://go.mitumba.africa/s/{storeSlug}` */
2703
+ declare function storeShareUrl(storeSlug: string, options?: ShareUrlOptions): string;
2704
+ /** `https://go.mitumba.africa/b/{baleId}` */
2705
+ declare function baleShareUrl(baleId: string, options?: ShareUrlOptions): string;
2706
+
2682
2707
  declare class MitumbaClient {
2683
2708
  readonly api: APIClient;
2684
2709
  readonly auth: AuthModule;
@@ -2732,4 +2757,4 @@ declare class MitumbaClient {
2732
2757
  isAuthenticated(): Promise<boolean>;
2733
2758
  }
2734
2759
 
2735
- export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };
2760
+ export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, listingShareUrl, storeShareUrl };
package/dist/index.d.ts CHANGED
@@ -248,6 +248,9 @@ interface PendingPayoutApproval {
248
248
  dispute_count: number;
249
249
  prior_payouts: number;
250
250
  active_restrictions: number;
251
+ /** Present once a finance operator has approved it; item stays in the queue until disbursed. */
252
+ approved_at: string | null;
253
+ approved_by: string | null;
251
254
  hold_reason: string | null;
252
255
  held_at: string | null;
253
256
  }
@@ -2679,6 +2682,28 @@ declare class WholesaleModule {
2679
2682
  }>;
2680
2683
  }
2681
2684
 
2685
+ /**
2686
+ * Canonical go.mitumba.africa share URLs — the one place clients build listing, store and bale share links.
2687
+ *
2688
+ * Forms follow Mitumba-Ltd/mitumba-links `docs/product/share-urls.md`: `/l/{listingId}`, `/s/{storeSlug}` and
2689
+ * `/b/{baleId}` with no slug, query or fragment. Pure functions: no network access, safe in any runtime.
2690
+ */
2691
+ declare const DEFAULT_SHARE_ORIGIN = "https://go.mitumba.africa";
2692
+ interface ShareUrlOptions {
2693
+ /**
2694
+ * Override the share origin, e.g. a staging Worker. Must be an `https://` origin (no path, query or
2695
+ * credentials); `http://localhost` / `http://127.0.0.1` are allowed for local development.
2696
+ * Defaults to {@link DEFAULT_SHARE_ORIGIN}.
2697
+ */
2698
+ origin?: string;
2699
+ }
2700
+ /** `https://go.mitumba.africa/l/{listingId}` */
2701
+ declare function listingShareUrl(listingId: string, options?: ShareUrlOptions): string;
2702
+ /** `https://go.mitumba.africa/s/{storeSlug}` */
2703
+ declare function storeShareUrl(storeSlug: string, options?: ShareUrlOptions): string;
2704
+ /** `https://go.mitumba.africa/b/{baleId}` */
2705
+ declare function baleShareUrl(baleId: string, options?: ShareUrlOptions): string;
2706
+
2682
2707
  declare class MitumbaClient {
2683
2708
  readonly api: APIClient;
2684
2709
  readonly auth: AuthModule;
@@ -2732,4 +2757,4 @@ declare class MitumbaClient {
2732
2757
  isAuthenticated(): Promise<boolean>;
2733
2758
  }
2734
2759
 
2735
- export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, createTokenStore };
2760
+ export { APIClient, APIError, type APIErrorResponse, type Add2FAMethodInput, type Add2FAMethodResult, type AddAddressInput, type AddDepotInput, type AddPaymentMethodInput, type Address, type AdminAuditEntry, type AdminAuthStrength, type AdminListingItem, AdminModule, type AdminOperator, type AdminOrderDetail, type AdminOrderListItem, type AdminPayoutItem, type AdminPermission, type AdminPermissionDescription, type AdminRecoveryEvent, type AdminRecoveryRequest, type AdminReport, type AdminRolePreset, type AdminStoreDetail, type AdminStoreListItem, type AdminUserDetail, type AdminUserListItem, type AdminVaziOutfit, type AdminVerificationItem, type AdminWholesalePendingStore, type AuthCapabilities, AuthModule, type AuthTokens, type AuthenticationResponseJSON, BALE_ORDER_STATUSES, type Bale, type BaleDetail, type BaleFeedItem, type BaleFulfillment, type BaleGrade, type BaleOrder, type BaleOrderEvent, type BaleOrderStatus, type BaleType, type BecomeBaleSellerInput, type BecomeSellerInput, type BlockedIp, type Business, type BusinessType, BusinessesModule, CONDITIONS, type CartItem, CartModule, type Category, type ChangePasswordInput, type CheckoutNextAction, type CheckoutOrder, type CheckoutPaymentMethod, type CheckoutStatus, type CheckoutStatusResponse, type City, type CompleteOnboardingInput, type CompleteRecoveryResult, type Condition, type Conversation, type CreateBaleInput, type CreateBaleOrderInput, type CreateListingInput, type CreateOrderInput, type CreateReportInput, type CreateReviewInput, type CreateStoreInput, DEFAULT_SHARE_ORIGIN, DESIRED_RESOLUTIONS, DISPUTE_REASONS, DISPUTE_STATUSES, type DeliveryAddress, type DesiredResolution, type Dispute, type DisputeEvent, type DisputeEvidence, type DisputeListParams, type DisputeReason, type DisputeStatus, DisputesModule, type EmailLoginInput, type EmailRegisterInput, type FollowedStore, type ForgotPasswordInput, IDBTokenStore, type InboxRealtimeEvent, type InitiateCheckoutInput, type InitiateCheckoutResponse, type KnownPaymentProvider, LISTING_STATUSES, type LinkedAccount, type LinkedAccountProvider, type Listing, type ListingImage, type ListingStatus, type ListingsFeedParams, ListingsModule, type LoginInput, MailerModule, type MailerTemplate, MemoryTokenStore, type Message, type MessageResponse, MessagesModule, MitumbaClient, type MitumbaClientConfig, type MpesaInput, type Notification, type NotificationPref, type NotificationType, NotificationsModule, ORDER_STATUSES, type OperatorPermissionGrant, type Order, type OrderEvent, type OrderHistoryParams, type OrderStatus, OrdersModule, PAYMENT_STATUSES, type PaginatedResponse, PayModule, type PaymentAttemptStatus, type PaymentMethod, type PaymentMethodType, type PaymentProvider, type PaymentStatus, type PaymentStatusResponse, type PaystackInitResponse, type PaystackInput, type PendingPayoutApproval, type PhoneLoginInput, type PhoneRegisterInput, type PresignImageResponse, type ProviderId, type PublicKeyCredentialCreationOptionsJSON, type PublicKeyCredentialRequestOptionsJSON, type RaiseDisputeInput, type RecoveryStatus, type RecoveryStatusResult, type RegenerateBackupCodesResult, type RegisterInput, type RegistrationResponseJSON, ReportsModule, type RequestOptions, type RequestRecoveryInput, type RequestRecoveryResult, type ResetPasswordInput, type ResolveDisputeInput, type RespondDisputeInput, type Review, type ReviewableOrder, ReviewsModule, type RootSetupInput, type RootSetupResult, type SaveSearchInput, type SaveWholesaleStoreInput, type SearchHistoryItem, SearchModule, type SearchParams, type SearchResult, type SellerProfile, type SellerStorefront, type SellerType, type SendEmailInput, type SendMessageInput, type SendOtpInput, type Session, SettingsModule, type ShareUrlOptions, type SimilarListing, type StiEvent, type StkPushInput, type StkPushResponse, type Store, type StoreAnalytics, type StoreSettings, type StoreStats, StoresModule, type SubscriptionTier, type SystemStats, TWO_FACTOR_METHOD_TYPES, type TokenStore, type TransitionOrderInput, type TrendingTerm, type TwoFactorMethod, type TwoFactorMethodType, type TwoFactorRequired, type UpdateBusinessInput, type UpdateListingInput, type UpdateProfileInput, type UpdateStoreInput, UploadsModule, type UserProfile, type VAZIOutfit, type VAZIOutfitDetail, type VAZIOutfitDetailItem, type VAZIOutfitItem, type VaziFeedParams, type VaziFeedResponse, VaziModule, type Verify2FAInput, type VerifyOtpInput, type WholesaleDepot, type WholesaleFeedParams, WholesaleModule, type WholesaleStore, type WishlistListing, WishlistsModule, baleShareUrl, createTokenStore, listingShareUrl, storeShareUrl };
package/dist/index.js CHANGED
@@ -1678,6 +1678,44 @@ var DISPUTE_STATUSES = ["open", "seller_responded", "under_review", "resolved_re
1678
1678
  // src/types/wholesale.ts
1679
1679
  var BALE_ORDER_STATUSES = ["pending_payment", "paid", "confirmed", "in_transit", "delivered", "completed", "cancelled"];
1680
1680
 
1681
+ // src/share.ts
1682
+ var DEFAULT_SHARE_ORIGIN = "https://go.mitumba.africa";
1683
+ var ID_PATTERN = /^[0-9a-f]{32}$/;
1684
+ var SLUG_PATTERN = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
1685
+ function resolveOrigin(origin) {
1686
+ if (origin === void 0) return DEFAULT_SHARE_ORIGIN;
1687
+ let url;
1688
+ try {
1689
+ url = new URL(origin);
1690
+ } catch {
1691
+ throw new TypeError(`Invalid share origin: ${origin}`);
1692
+ }
1693
+ const local = url.protocol === "http:" && (url.hostname === "localhost" || url.hostname === "127.0.0.1");
1694
+ if (url.protocol !== "https:" && !local || url.username || url.password) {
1695
+ throw new TypeError(`Share origin must be https:// (or http://localhost): ${origin}`);
1696
+ }
1697
+ if (url.pathname !== "/" && url.pathname !== "" || url.search || url.hash) {
1698
+ throw new TypeError(`Share origin must not include a path, query or fragment: ${origin}`);
1699
+ }
1700
+ return url.origin;
1701
+ }
1702
+ function identifier(kind, value) {
1703
+ const normalized = typeof value === "string" ? value.trim().toLowerCase() : "";
1704
+ if (!ID_PATTERN.test(normalized)) throw new TypeError(`Invalid ${kind} ID: ${String(value)}`);
1705
+ return normalized;
1706
+ }
1707
+ function listingShareUrl(listingId, options = {}) {
1708
+ return `${resolveOrigin(options.origin)}/l/${encodeURIComponent(identifier("listing", listingId))}`;
1709
+ }
1710
+ function storeShareUrl(storeSlug, options = {}) {
1711
+ const slug = typeof storeSlug === "string" ? storeSlug.trim().toLowerCase() : "";
1712
+ if (slug.length > 64 || !SLUG_PATTERN.test(slug)) throw new TypeError(`Invalid store slug: ${String(storeSlug)}`);
1713
+ return `${resolveOrigin(options.origin)}/s/${encodeURIComponent(slug)}`;
1714
+ }
1715
+ function baleShareUrl(baleId, options = {}) {
1716
+ return `${resolveOrigin(options.origin)}/b/${encodeURIComponent(identifier("bale", baleId))}`;
1717
+ }
1718
+
1681
1719
  // src/index.ts
1682
1720
  var MitumbaClient = class {
1683
1721
  api;
@@ -1771,6 +1809,7 @@ exports.BALE_ORDER_STATUSES = BALE_ORDER_STATUSES;
1771
1809
  exports.BusinessesModule = BusinessesModule;
1772
1810
  exports.CONDITIONS = CONDITIONS;
1773
1811
  exports.CartModule = CartModule;
1812
+ exports.DEFAULT_SHARE_ORIGIN = DEFAULT_SHARE_ORIGIN;
1774
1813
  exports.DESIRED_RESOLUTIONS = DESIRED_RESOLUTIONS;
1775
1814
  exports.DISPUTE_REASONS = DISPUTE_REASONS;
1776
1815
  exports.DISPUTE_STATUSES = DISPUTE_STATUSES;
@@ -1797,6 +1836,9 @@ exports.UploadsModule = UploadsModule;
1797
1836
  exports.VaziModule = VaziModule;
1798
1837
  exports.WholesaleModule = WholesaleModule;
1799
1838
  exports.WishlistsModule = WishlistsModule;
1839
+ exports.baleShareUrl = baleShareUrl;
1800
1840
  exports.createTokenStore = createTokenStore;
1841
+ exports.listingShareUrl = listingShareUrl;
1842
+ exports.storeShareUrl = storeShareUrl;
1801
1843
  //# sourceMappingURL=index.js.map
1802
1844
  //# sourceMappingURL=index.js.map