@basedone/core 0.2.1 → 0.2.3

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.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { SpotToken, MarginTables, PerpsAssetCtx, SpotMeta, ExchangeClient, SuccessResponse, InfoClient } from '@nktkas/hyperliquid';
2
2
  import { Hex } from '@nktkas/hyperliquid/types';
3
3
  export { A as AllPerpsMeta, d as AssetIdUtils, B as BaseInstrument, I as InstrumentClient, M as MarketInstrument, c as PerpsInstrument, P as PerpsMeta, a as PerpsMetaAndAssetCtxs, b as PerpsUniverse, S as SpotInstrument, g as getAllPerpsMeta } from './client-CgmiTuEX.js';
4
- export { ActiveFlashSalesResponse, AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateFlashSaleRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerMessagesResponse, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, FlashSale, FlashSaleItem, FlashSaleItemInput, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, ListActiveFlashSalesParams, ListBannersResponse, ListCouponsResponse, ListCustomersParams, ListCustomersResponse, ListInventoryAuditResponse, ListMediaAssetsResponse, ListMessagesResponse, ListOrdersParams, ListOrdersResponse, ListProductVariantsResponse, ListProductsParams, ListProductsResponse, ListReturnsResponse, ListReviewsParams, ListReviewsResponse, ListShipmentsResponse, ListShippingAddressesResponse, ListShippingMethodsResponse, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProfileRequest, MerchantProfileResponse, MerchantStatus, Message, MessageResponse, MessageStatsResponse, Order, OrderEvent, OrderItem, OrderReceiptResponse, OrderStatus, OrdersByStatus, PaginatedResponse, PaginationParams, Payment, PaymentMethod, PaymentStatus, Product, ProductDimensions, ProductDiscountsResponse, ProductMetrics, ProductResponse, ProductReview, ProductSortBy, ProductVariant, ProductVariantResponse, RecentOrderSummary, RespondToReviewRequest, Return, ReturnItem, ReturnResponse, ReturnStatus, RevenueByDay, ReviewResponse, ReviewSortBy, ReviewStatus, SendMessageRequest, Settlement, Shipment, ShipmentResponse, ShipmentStatus, ShippingAddress, ShippingAddressRequest, ShippingAddressResponse, ShippingMethod, ShippingMethodResponse, SortOrder, SuccessResponse, TaxBehavior, TaxBreakdownItem, TaxNexus, TaxNexusResponse, TaxReport, TaxReportDetails, TaxReportPeriodType, TaxReportResponse, TaxReportStatus, TaxRule, TaxRuleResponse, TaxSettings, TaxSettingsResponse, TaxType, TopProduct, TrackBannerRequest, UpdateBannerRequest, UpdateCouponRequest, UpdateFlashSaleRequest, UpdateOrderResponse, UpdateOrderStatusRequest, UpdateProductRequest, UpdateProductVariantRequest, UpdateShipmentRequest, UpdateShippingMethodRequest, UpdateTaxNexusRequest, UpdateTaxReportStatusRequest, UpdateTaxRuleRequest, UpdateTaxSettingsRequest, UserShippingAddress, ValidateDiscountRequest, ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './ecommerce.js';
4
+ export { ActiveFlashSalesResponse, AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateShippingRequest, CalculateShippingResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateFlashSaleRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateShippingRateRequest, CreateShippingZoneRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerMessagesResponse, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, FlashSale, FlashSaleItem, FlashSaleItemInput, FollowActionResponse, FollowStatusResponse, FollowedMerchantSummary, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetPaymentMethodsResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, ListActiveFlashSalesParams, ListBannersResponse, ListCouponsResponse, ListCustomersParams, ListCustomersResponse, ListFollowingParams, ListFollowingResponse, ListInventoryAuditResponse, ListMediaAssetsResponse, ListMerchantProductsParams, ListMessagesResponse, ListOrdersParams, ListOrdersResponse, ListProductVariantsResponse, ListProductsParams, ListProductsResponse, ListReturnsResponse, ListReviewsParams, ListReviewsResponse, ListShipmentsResponse, ListShippingAddressesResponse, ListShippingMethodsResponse, ListShippingRatesResponse, ListShippingZonesResponse, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProductsResponse, MerchantProfileRequest, MerchantProfileResponse, MerchantShippingSettings, MerchantStatus, Message, MessageResponse, MessageStatsResponse, Order, OrderEvent, OrderItem, OrderReceiptResponse, OrderStatus, OrdersByStatus, PaginatedResponse, PaginationParams, Payment, PaymentMethod, PaymentMethodInfo, PaymentStatus, ProcessPaymentRequest, ProcessPaymentResponse, Product, ProductDimensions, ProductDiscountsResponse, ProductMetrics, ProductResponse, ProductReview, ProductSortBy, ProductVariant, ProductVariantResponse, PublicMerchantProfile, PublicMerchantProfileResponse, RecentOrderSummary, RespondToReviewRequest, Return, ReturnItem, ReturnResponse, ReturnStatus, RevenueByDay, ReviewResponse, ReviewSortBy, ReviewStatus, SendMessageRequest, Settlement, Shipment, ShipmentResponse, ShipmentStatus, ShippingAddress, ShippingAddressRequest, ShippingAddressResponse, ShippingMethod, ShippingMethodResponse, ShippingOption, ShippingRate, ShippingRateResponse, ShippingSettingsResponse, ShippingZone, ShippingZoneResponse, SortOrder, SuccessResponse, TaxBehavior, TaxBreakdownItem, TaxNexus, TaxNexusResponse, TaxReport, TaxReportDetails, TaxReportPeriodType, TaxReportResponse, TaxReportStatus, TaxRule, TaxRuleResponse, TaxSettings, TaxSettingsResponse, TaxType, TopProduct, TrackBannerRequest, UpdateBannerRequest, UpdateCouponRequest, UpdateFlashSaleRequest, UpdateOrderResponse, UpdateOrderStatusRequest, UpdateProductRequest, UpdateProductVariantRequest, UpdateShipmentRequest, UpdateShippingMethodRequest, UpdateShippingRateRequest, UpdateShippingSettingsRequest, UpdateShippingZoneRequest, UpdateTaxNexusRequest, UpdateTaxReportStatusRequest, UpdateTaxRuleRequest, UpdateTaxSettingsRequest, UserShippingAddress, ValidateDiscountRequest, ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './ecommerce.js';
5
5
  import 'axios';
6
6
 
7
7
  declare function encodeSlug(slug: string): bigint;
@@ -527,7 +527,7 @@ declare const formatPriceForDisplay: ({ px, szDecimals, isSpot, }: {
527
527
  * @returns Formatted size as number (rounded down to szDecimals if exceeds)
528
528
  */
529
529
  declare const formatSizeForOrder: ({ sz, szDecimals, }: {
530
- sz: number;
530
+ sz: number | string;
531
531
  szDecimals: number;
532
532
  }) => number;
533
533
  /**
@@ -597,6 +597,15 @@ interface WeekInfo {
597
597
  * @returns WeekInfo with weekNumber, startDate, and endDate
598
598
  */
599
599
  declare function getLatestCompletedWeek(currentTimestamp?: number, offset?: number, weekStartsOn?: DayOfWeek): WeekInfo;
600
+ /**
601
+ * Gets week information from a week number.
602
+ * This is the inverse of getLatestCompletedWeek - it converts a week number to start/end dates.
603
+ *
604
+ * @param weekNumber - The week number (1-based, where week 1 starts at WEEK1_START_DATE)
605
+ * @param weekStartsOn - Day of week the week should start on. Defaults to Thursday.
606
+ * @returns WeekInfo with weekNumber, startDate, and endDate
607
+ */
608
+ declare function getWeekInfoFromNumber(weekNumber: number, weekStartsOn?: DayOfWeek): WeekInfo;
600
609
 
601
610
  declare function isHip3Symbol(symbol: string | undefined): boolean;
602
611
  declare function getHip3Dex(symbol: string): string | null;
@@ -643,4 +652,4 @@ declare function isStableQuoteToken(coin: string): boolean;
643
652
  declare function getDisplayMarketSymbol(coin: string | undefined, showCollateralTokenSymbol?: boolean, collateralTokenSymbol?: string): string | undefined;
644
653
  declare function getDexFromCollateralTokenSymbol(collateralTokenSymbol: string): string | undefined;
645
654
 
646
- export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, DayOfWeek, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, type WeekInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
655
+ export { type AirdropAllocationData, CloidClientCode, type CloidClientCodeId, CloidClientCodeNameById, type CloidData, DayOfWeek, type DexInfo, type ExtendedPerpsMeta, type MarketInfo, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, type PerpDex, type PupEligibilityResult, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, type TokenInfo, USDC_SPOT_TOKEN, type UpheavalApiResponse, type UpheavalPosition, type UpheavalSnapshot, UserDexAbstractionTypes, type V3LPTokenInfo, type WeekInfo, WidgetType, WidgetTypeById, type WidgetTypeId, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getApprovalAmount, getClientCodeNameById, getCloid, getDexFromCollateralTokenSymbol, getDisplayMarketSymbol, getHip3Dex, getHip3DexAbstraction, getLatestCompletedWeek, getNextTierInfo, getPriceDecimals, getStaticCollateralTokenByDex, getStaticCollateralTokenSymbol, getWeekInfoFromNumber, getWidgetTypeById, isBasedCloid, isClientCode, isHip3Symbol, isMiniAppCloid, isMiniAppTriggeredCloid, isSpotSymbol, isStableQuoteToken, isTenantCloid, isTrackingIdCloid, isWidgetType, makeUtcRounder, normaliseSlug, normaliseTrackingId, normalizeAirdropAmount, parseCloid, setHip3DexAbstraction, stableQuoteTokens };
package/dist/index.js CHANGED
@@ -42086,6 +42086,12 @@ function getLatestCompletedWeek(currentTimestamp, offset = 0, weekStartsOn = 4 /
42086
42086
  const weekNumber = Math.round(msSinceWeek1 / WEEK_IN_MS) + 1;
42087
42087
  return { weekNumber, startDate, endDate };
42088
42088
  }
42089
+ function getWeekInfoFromNumber(weekNumber, weekStartsOn = 4 /* Thursday */) {
42090
+ const week1StartDate = new Date(process.env.WEEK1_START_DATE || "2025-12-04T00:00:00Z");
42091
+ const startDate = new Date(week1StartDate.getTime() + (weekNumber - 1) * WEEK_IN_MS);
42092
+ const endDate = new Date(startDate.getTime() + WEEK_IN_MS);
42093
+ return { weekNumber, startDate, endDate };
42094
+ }
42089
42095
 
42090
42096
  // lib/hip3/market-info.ts
42091
42097
  async function getAllPerpsMeta(infoClient) {
@@ -42460,11 +42466,13 @@ var BaseEcommerceClient = class {
42460
42466
  maxRetries: config.maxRetries || 3,
42461
42467
  retryBaseDelay: config.retryBaseDelay || 1e3,
42462
42468
  headers: config.headers,
42463
- enableRetry: config.enableRetry !== false
42469
+ enableRetry: config.enableRetry !== false,
42470
+ withCredentials: config.withCredentials || false
42464
42471
  };
42465
42472
  this.axiosInstance = axios__default.default.create({
42466
42473
  baseURL: this.config.baseURL,
42467
42474
  timeout: this.config.timeout,
42475
+ withCredentials: this.config.withCredentials,
42468
42476
  headers: {
42469
42477
  "Content-Type": "application/json",
42470
42478
  ...this.config.headers
@@ -43008,6 +43016,34 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
43008
43016
  return this.post("/api/marketplace/tax/calculate", request);
43009
43017
  }
43010
43018
  // ============================================================================
43019
+ // Shipping Calculation API
43020
+ // ============================================================================
43021
+ /**
43022
+ * Calculate shipping options for cart items
43023
+ *
43024
+ * @param request - Cart items, merchant, and destination
43025
+ * @returns Available shipping options with costs
43026
+ *
43027
+ * @example
43028
+ * ```typescript
43029
+ * const result = await client.calculateShippingOptions({
43030
+ * merchantId: "merchant_123",
43031
+ * cartItems: [
43032
+ * { productId: "prod_123", quantity: 2 }
43033
+ * ],
43034
+ * destinationCountry: "US",
43035
+ * orderSubtotal: 99.99
43036
+ * });
43037
+ *
43038
+ * result.shippingOptions.forEach(opt => {
43039
+ * console.log(opt.name, opt.cost, opt.estimatedDelivery);
43040
+ * });
43041
+ * ```
43042
+ */
43043
+ async calculateShippingOptions(request) {
43044
+ return this.post("/api/marketplace/shipping/calculate", request);
43045
+ }
43046
+ // ============================================================================
43011
43047
  // Banners API
43012
43048
  // ============================================================================
43013
43049
  /**
@@ -43151,6 +43187,143 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
43151
43187
  const queryString = params ? buildQueryString(params) : "";
43152
43188
  return this.get(`/api/marketplace/flash-sales/active${queryString}`);
43153
43189
  }
43190
+ // ============================================================================
43191
+ // Merchant Storefront API
43192
+ // ============================================================================
43193
+ /**
43194
+ * Get public merchant profile
43195
+ *
43196
+ * Fetches public information about a merchant for the storefront page.
43197
+ *
43198
+ * @param merchantId - Merchant ID
43199
+ * @returns Public merchant profile with stats
43200
+ *
43201
+ * @example
43202
+ * ```typescript
43203
+ * const result = await client.getMerchantProfile("merchant_123");
43204
+ * console.log(result.merchant.name, result.merchant.productCount);
43205
+ * ```
43206
+ */
43207
+ async getMerchantProfile(merchantId) {
43208
+ return this.get(`/api/marketplace/merchants/${merchantId}`);
43209
+ }
43210
+ /**
43211
+ * List merchant products
43212
+ *
43213
+ * Fetches products for a specific merchant with search, filter, and sort options.
43214
+ *
43215
+ * @param merchantId - Merchant ID
43216
+ * @param params - Query parameters for filtering and pagination
43217
+ * @returns Paginated list of products
43218
+ *
43219
+ * @example
43220
+ * ```typescript
43221
+ * const result = await client.getMerchantProducts("merchant_123", {
43222
+ * search: "laptop",
43223
+ * sortBy: "popular",
43224
+ * limit: 20,
43225
+ * });
43226
+ *
43227
+ * result.items.forEach(product => {
43228
+ * console.log(product.title, product.priceUSDC);
43229
+ * });
43230
+ * ```
43231
+ */
43232
+ async getMerchantProducts(merchantId, params) {
43233
+ const queryString = params ? buildQueryString(params) : "";
43234
+ return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
43235
+ }
43236
+ // ============================================================================
43237
+ // Shop Following API
43238
+ // ============================================================================
43239
+ /**
43240
+ * Check if following a merchant
43241
+ *
43242
+ * @param merchantId - Merchant ID
43243
+ * @returns Follow status with follow date if applicable
43244
+ *
43245
+ * @example
43246
+ * ```typescript
43247
+ * const status = await client.isFollowingMerchant("merchant_123");
43248
+ * if (status.isFollowing) {
43249
+ * console.log(`Following since ${status.followedAt}`);
43250
+ * }
43251
+ * ```
43252
+ */
43253
+ async isFollowingMerchant(merchantId) {
43254
+ return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
43255
+ }
43256
+ /**
43257
+ * Follow a merchant
43258
+ *
43259
+ * @param merchantId - Merchant ID to follow
43260
+ * @returns Follow action result
43261
+ *
43262
+ * @example
43263
+ * ```typescript
43264
+ * const result = await client.followMerchant("merchant_123");
43265
+ * console.log(result.message); // "Now following Awesome Store"
43266
+ * ```
43267
+ */
43268
+ async followMerchant(merchantId) {
43269
+ return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
43270
+ }
43271
+ /**
43272
+ * Unfollow a merchant
43273
+ *
43274
+ * @param merchantId - Merchant ID to unfollow
43275
+ * @returns Unfollow action result
43276
+ *
43277
+ * @example
43278
+ * ```typescript
43279
+ * const result = await client.unfollowMerchant("merchant_123");
43280
+ * console.log(result.message); // "Unfollowed successfully"
43281
+ * ```
43282
+ */
43283
+ async unfollowMerchant(merchantId) {
43284
+ return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
43285
+ }
43286
+ /**
43287
+ * Get list of followed merchants
43288
+ *
43289
+ * @param params - Query parameters for pagination and sorting
43290
+ * @returns Paginated list of followed merchants with their info
43291
+ *
43292
+ * @example
43293
+ * ```typescript
43294
+ * const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
43295
+ * result.items.forEach(item => {
43296
+ * console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
43297
+ * });
43298
+ * ```
43299
+ */
43300
+ async getFollowedMerchants(params) {
43301
+ const queryString = params ? buildQueryString(params) : "";
43302
+ return this.get(`/api/marketplace/following${queryString}`);
43303
+ }
43304
+ // ============================================================================
43305
+ // Payment Methods
43306
+ // ============================================================================
43307
+ /**
43308
+ * Get available payment methods
43309
+ *
43310
+ * Returns the list of enabled payment methods that can be used during checkout.
43311
+ *
43312
+ * @returns List of available payment methods with display info
43313
+ *
43314
+ * @example
43315
+ * ```typescript
43316
+ * const result = await client.getPaymentMethods();
43317
+ * if (result.paymentsEnabled) {
43318
+ * result.methods.forEach(method => {
43319
+ * console.log(`${method.name}: ${method.description}`);
43320
+ * });
43321
+ * }
43322
+ * ```
43323
+ */
43324
+ async getPaymentMethods() {
43325
+ return this.get("/api/marketplace/payments/methods");
43326
+ }
43154
43327
  };
43155
43328
 
43156
43329
  // lib/ecommerce/client/merchant.ts
@@ -43685,6 +43858,192 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
43685
43858
  return this.patch(`/api/marketplace/merchant/shipping/shipments/${shipmentId}`, request);
43686
43859
  }
43687
43860
  // ============================================================================
43861
+ // Shipping Settings (Zones & Rates)
43862
+ // ============================================================================
43863
+ /**
43864
+ * Get merchant shipping settings
43865
+ *
43866
+ * @returns Shipping settings
43867
+ *
43868
+ * @example
43869
+ * ```typescript
43870
+ * const { settings } = await client.getShippingSettings();
43871
+ * console.log("Handling fee:", settings.defaultHandlingFee);
43872
+ * ```
43873
+ */
43874
+ async getShippingSettings() {
43875
+ return this.get("/api/marketplace/merchant/shipping/settings");
43876
+ }
43877
+ /**
43878
+ * Update merchant shipping settings
43879
+ *
43880
+ * @param request - Settings to update
43881
+ * @returns Updated settings
43882
+ *
43883
+ * @example
43884
+ * ```typescript
43885
+ * await client.updateShippingSettings({
43886
+ * defaultHandlingFee: 2.50,
43887
+ * freeShippingEnabled: true,
43888
+ * freeShippingThreshold: 100
43889
+ * });
43890
+ * ```
43891
+ */
43892
+ async updateShippingSettings(request) {
43893
+ return this.post("/api/marketplace/merchant/shipping/settings", request);
43894
+ }
43895
+ /**
43896
+ * List all shipping zones
43897
+ *
43898
+ * @returns List of shipping zones with rate counts
43899
+ *
43900
+ * @example
43901
+ * ```typescript
43902
+ * const { zones } = await client.listShippingZones();
43903
+ * zones.forEach(z => console.log(z.name, z.countries.length, "countries"));
43904
+ * ```
43905
+ */
43906
+ async listShippingZones() {
43907
+ return this.get("/api/marketplace/merchant/shipping/zones");
43908
+ }
43909
+ /**
43910
+ * Get a shipping zone by ID
43911
+ *
43912
+ * @param zoneId - Zone ID
43913
+ * @returns Zone with rates
43914
+ *
43915
+ * @example
43916
+ * ```typescript
43917
+ * const { zone } = await client.getShippingZone("zone_123");
43918
+ * console.log(zone.name, zone.rates?.length, "rates");
43919
+ * ```
43920
+ */
43921
+ async getShippingZone(zoneId) {
43922
+ return this.get(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
43923
+ }
43924
+ /**
43925
+ * Create a shipping zone
43926
+ *
43927
+ * @param request - Zone data
43928
+ * @returns Created zone
43929
+ *
43930
+ * @example
43931
+ * ```typescript
43932
+ * const { zone } = await client.createShippingZone({
43933
+ * name: "Southeast Asia",
43934
+ * countries: ["SG", "MY", "TH", "ID", "PH", "VN"],
43935
+ * isDefault: false,
43936
+ * priority: 10
43937
+ * });
43938
+ * ```
43939
+ */
43940
+ async createShippingZone(request) {
43941
+ return this.post("/api/marketplace/merchant/shipping/zones", request);
43942
+ }
43943
+ /**
43944
+ * Update a shipping zone
43945
+ *
43946
+ * @param zoneId - Zone ID
43947
+ * @param request - Updated zone data
43948
+ * @returns Updated zone
43949
+ *
43950
+ * @example
43951
+ * ```typescript
43952
+ * await client.updateShippingZone("zone_123", {
43953
+ * countries: ["SG", "MY", "TH", "ID", "PH", "VN", "BN"]
43954
+ * });
43955
+ * ```
43956
+ */
43957
+ async updateShippingZone(zoneId, request) {
43958
+ return this.put(`/api/marketplace/merchant/shipping/zones/${zoneId}`, request);
43959
+ }
43960
+ /**
43961
+ * Delete a shipping zone
43962
+ *
43963
+ * @param zoneId - Zone ID
43964
+ * @returns Success response
43965
+ *
43966
+ * @example
43967
+ * ```typescript
43968
+ * await client.deleteShippingZone("zone_123");
43969
+ * ```
43970
+ */
43971
+ async deleteShippingZone(zoneId) {
43972
+ return this.delete(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
43973
+ }
43974
+ /**
43975
+ * List shipping rates
43976
+ *
43977
+ * @param zoneId - Optional zone ID to filter by
43978
+ * @returns List of shipping rates
43979
+ *
43980
+ * @example
43981
+ * ```typescript
43982
+ * // All rates
43983
+ * const { rates } = await client.listShippingRates();
43984
+ *
43985
+ * // Rates for a specific zone
43986
+ * const { rates: zoneRates } = await client.listShippingRates("zone_123");
43987
+ * ```
43988
+ */
43989
+ async listShippingRates(zoneId) {
43990
+ const query = zoneId ? `?zoneId=${zoneId}` : "";
43991
+ return this.get(`/api/marketplace/merchant/shipping/rates${query}`);
43992
+ }
43993
+ /**
43994
+ * Create a shipping rate
43995
+ *
43996
+ * @param request - Rate data
43997
+ * @returns Created rate
43998
+ *
43999
+ * @example
44000
+ * ```typescript
44001
+ * const { rate } = await client.createShippingRate({
44002
+ * zoneId: "zone_123",
44003
+ * name: "Standard Shipping",
44004
+ * baseRate: 5.00,
44005
+ * perKgRate: 1.50,
44006
+ * minDeliveryDays: 7,
44007
+ * maxDeliveryDays: 14
44008
+ * });
44009
+ * ```
44010
+ */
44011
+ async createShippingRate(request) {
44012
+ return this.post("/api/marketplace/merchant/shipping/rates", request);
44013
+ }
44014
+ /**
44015
+ * Update a shipping rate
44016
+ *
44017
+ * @param rateId - Rate ID
44018
+ * @param request - Updated rate data
44019
+ * @returns Updated rate
44020
+ *
44021
+ * @example
44022
+ * ```typescript
44023
+ * await client.updateShippingRate("rate_123", {
44024
+ * baseRate: 6.00,
44025
+ * freeAboveAmount: 75
44026
+ * });
44027
+ * ```
44028
+ */
44029
+ async updateShippingRate(rateId, request) {
44030
+ return this.put(`/api/marketplace/merchant/shipping/rates/${rateId}`, request);
44031
+ }
44032
+ /**
44033
+ * Delete a shipping rate
44034
+ *
44035
+ * @param rateId - Rate ID
44036
+ * @returns Success response
44037
+ *
44038
+ * @example
44039
+ * ```typescript
44040
+ * await client.deleteShippingRate("rate_123");
44041
+ * ```
44042
+ */
44043
+ async deleteShippingRate(rateId) {
44044
+ return this.delete(`/api/marketplace/merchant/shipping/rates/${rateId}`);
44045
+ }
44046
+ // ============================================================================
43688
44047
  // Returns & Refunds
43689
44048
  // ============================================================================
43690
44049
  /**
@@ -44282,6 +44641,223 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
44282
44641
  async exportTaxReport(reportId) {
44283
44642
  return this.get(`/api/marketplace/merchant/tax-reports/${reportId}/export`);
44284
44643
  }
44644
+ // ============================================
44645
+ // DROPSHIPPING APIs
44646
+ // ============================================
44647
+ /**
44648
+ * List connected dropship suppliers
44649
+ *
44650
+ * @returns Connected and available suppliers
44651
+ *
44652
+ * @example
44653
+ * ```typescript
44654
+ * const { connected, available } = await client.listDropshipSuppliers();
44655
+ * ```
44656
+ */
44657
+ async listDropshipSuppliers() {
44658
+ return this.get("/api/marketplace/merchant/dropship/suppliers");
44659
+ }
44660
+ /**
44661
+ * Connect a new dropship supplier
44662
+ *
44663
+ * @param request - Supplier credentials
44664
+ * @returns Connected supplier
44665
+ *
44666
+ * @example
44667
+ * ```typescript
44668
+ * const supplier = await client.connectDropshipSupplier({
44669
+ * code: "CJ_DROPSHIPPING",
44670
+ * apiKey: "your-api-key"
44671
+ * });
44672
+ * ```
44673
+ */
44674
+ async connectDropshipSupplier(request) {
44675
+ return this.post("/api/marketplace/merchant/dropship/suppliers", request);
44676
+ }
44677
+ /**
44678
+ * Update dropship supplier settings
44679
+ *
44680
+ * @param supplierId - Supplier ID
44681
+ * @param request - Settings to update
44682
+ * @returns Updated supplier
44683
+ */
44684
+ async updateDropshipSupplier(supplierId, request) {
44685
+ return this.put(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`, request);
44686
+ }
44687
+ /**
44688
+ * Disconnect a dropship supplier
44689
+ *
44690
+ * @param supplierId - Supplier ID
44691
+ */
44692
+ async disconnectDropshipSupplier(supplierId) {
44693
+ return this.delete(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`);
44694
+ }
44695
+ /**
44696
+ * Search products from connected suppliers
44697
+ *
44698
+ * @param request - Search parameters
44699
+ * @returns Search results with pagination
44700
+ *
44701
+ * @example
44702
+ * ```typescript
44703
+ * const results = await client.searchDropshipProducts({
44704
+ * supplierId: "supplier_123",
44705
+ * query: "wireless headphones",
44706
+ * limit: 20
44707
+ * });
44708
+ * ```
44709
+ */
44710
+ async searchDropshipProducts(request) {
44711
+ return this.post("/api/marketplace/merchant/dropship/search", request);
44712
+ }
44713
+ /**
44714
+ * Get dropship supplier categories
44715
+ *
44716
+ * @param supplierId - Supplier ID
44717
+ * @returns Category list
44718
+ */
44719
+ async getDropshipCategories(supplierId) {
44720
+ return this.get(`/api/marketplace/merchant/dropship/categories?supplierId=${supplierId}`);
44721
+ }
44722
+ /**
44723
+ * Get detailed product info from supplier
44724
+ *
44725
+ * @param supplierId - Supplier ID
44726
+ * @param externalProductId - Supplier's product ID
44727
+ * @returns Product details with suggested pricing
44728
+ */
44729
+ async getDropshipProductDetails(supplierId, externalProductId) {
44730
+ return this.get(
44731
+ `/api/marketplace/merchant/dropship/products/${encodeURIComponent(externalProductId)}?supplierId=${supplierId}`
44732
+ );
44733
+ }
44734
+ /**
44735
+ * Import a product from supplier to your store
44736
+ *
44737
+ * @param request - Import parameters
44738
+ * @returns Created product IDs
44739
+ *
44740
+ * @example
44741
+ * ```typescript
44742
+ * const result = await client.importDropshipProduct({
44743
+ * supplierId: "supplier_123",
44744
+ * externalProductId: "ext_product_456",
44745
+ * priceUSDC: 29.99,
44746
+ * title: "Custom Title"
44747
+ * });
44748
+ * ```
44749
+ */
44750
+ async importDropshipProduct(request) {
44751
+ return this.post("/api/marketplace/merchant/dropship/import", request);
44752
+ }
44753
+ /**
44754
+ * Bulk import products from supplier
44755
+ *
44756
+ * @param request - Bulk import parameters
44757
+ * @returns Import results
44758
+ */
44759
+ async bulkImportDropshipProducts(request) {
44760
+ return this.post("/api/marketplace/merchant/dropship/import", request);
44761
+ }
44762
+ /**
44763
+ * List imported dropship products
44764
+ *
44765
+ * @param params - Filter parameters
44766
+ * @returns Imported products list
44767
+ */
44768
+ async listDropshipProducts(params) {
44769
+ const query = params ? `?${buildQueryString(params)}` : "";
44770
+ return this.get(`/api/marketplace/merchant/dropship/import${query}`);
44771
+ }
44772
+ /**
44773
+ * List dropship order links
44774
+ *
44775
+ * @param params - Filter parameters
44776
+ * @returns Order links with status summary
44777
+ */
44778
+ async listDropshipOrders(params) {
44779
+ let query = "";
44780
+ if (params) {
44781
+ const queryParams = {};
44782
+ if (params.status) {
44783
+ queryParams.status = Array.isArray(params.status) ? params.status.join(",") : params.status;
44784
+ }
44785
+ if (params.limit) queryParams.limit = params.limit.toString();
44786
+ if (params.offset) queryParams.offset = params.offset.toString();
44787
+ query = `?${buildQueryString(queryParams)}`;
44788
+ }
44789
+ return this.get(`/api/marketplace/merchant/dropship/orders${query}`);
44790
+ }
44791
+ /**
44792
+ * Forward orders to supplier
44793
+ *
44794
+ * @param orderItemIds - Order item IDs to forward
44795
+ * @returns Forward results
44796
+ */
44797
+ async forwardDropshipOrders(orderItemIds) {
44798
+ return this.post("/api/marketplace/merchant/dropship/orders", {
44799
+ action: "forward",
44800
+ orderItemIds
44801
+ });
44802
+ }
44803
+ /**
44804
+ * Sync tracking for all pending dropship orders
44805
+ *
44806
+ * @returns Sync results
44807
+ */
44808
+ async syncDropshipTracking() {
44809
+ return this.post("/api/marketplace/merchant/dropship/orders", {
44810
+ action: "sync"
44811
+ });
44812
+ }
44813
+ /**
44814
+ * Get order forwarding details for manual forwarding
44815
+ *
44816
+ * @param orderItemId - Order item ID
44817
+ * @returns Forwarding details
44818
+ */
44819
+ async getDropshipOrderDetails(orderItemId) {
44820
+ return this.get(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`);
44821
+ }
44822
+ /**
44823
+ * Forward a single order item to supplier
44824
+ *
44825
+ * @param orderItemId - Order item ID
44826
+ * @returns Forward result
44827
+ */
44828
+ async forwardDropshipOrder(orderItemId) {
44829
+ return this.post(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`, {});
44830
+ }
44831
+ /**
44832
+ * Get dropship settings
44833
+ *
44834
+ * @returns Merchant dropship settings
44835
+ */
44836
+ async getDropshipSettings() {
44837
+ return this.get("/api/marketplace/merchant/dropship/settings");
44838
+ }
44839
+ /**
44840
+ * Update dropship settings
44841
+ *
44842
+ * @param request - Settings to update
44843
+ * @returns Updated settings
44844
+ */
44845
+ async updateDropshipSettings(request) {
44846
+ return this.put("/api/marketplace/merchant/dropship/settings", request);
44847
+ }
44848
+ /**
44849
+ * Sync dropship products and/or orders
44850
+ *
44851
+ * @param type - Sync type (products, orders, all, single)
44852
+ * @param dropshipProductId - For single product sync
44853
+ * @returns Sync results
44854
+ */
44855
+ async syncDropship(type, dropshipProductId) {
44856
+ return this.post("/api/marketplace/merchant/dropship/sync", {
44857
+ type,
44858
+ dropshipProductId
44859
+ });
44860
+ }
44285
44861
  };
44286
44862
 
44287
44863
  // lib/ecommerce/types/enums.ts
@@ -44299,6 +44875,8 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
44299
44875
  })(OrderStatus || {});
44300
44876
  var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
44301
44877
  PaymentMethod2["USDC_ESCROW"] = "USDC_ESCROW";
44878
+ PaymentMethod2["BASEDPAY"] = "BASEDPAY";
44879
+ PaymentMethod2["STRIPE"] = "STRIPE";
44302
44880
  PaymentMethod2["POINTS"] = "POINTS";
44303
44881
  return PaymentMethod2;
44304
44882
  })(PaymentMethod || {});
@@ -44491,6 +45069,7 @@ exports.getNextTierInfo = getNextTierInfo;
44491
45069
  exports.getPriceDecimals = getPriceDecimals;
44492
45070
  exports.getStaticCollateralTokenByDex = getStaticCollateralTokenByDex;
44493
45071
  exports.getStaticCollateralTokenSymbol = getStaticCollateralTokenSymbol;
45072
+ exports.getWeekInfoFromNumber = getWeekInfoFromNumber;
44494
45073
  exports.getWidgetTypeById = getWidgetTypeById;
44495
45074
  exports.isBasedCloid = isBasedCloid;
44496
45075
  exports.isClientCode = isClientCode;