@basedone/core 0.2.2 → 0.2.4

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.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
  /**
@@ -43265,6 +43301,171 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
43265
43301
  const queryString = params ? buildQueryString(params) : "";
43266
43302
  return this.get(`/api/marketplace/following${queryString}`);
43267
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
+ }
43327
+ // ============================================================================
43328
+ // GEM System API
43329
+ // ============================================================================
43330
+ /**
43331
+ * Get user's gem balance
43332
+ *
43333
+ * Returns the current gem balance including total gems, available gems,
43334
+ * and gems expiring soon. Gems are earned at 100 per $1 of revenue.
43335
+ *
43336
+ * @returns Current gem balance with USD equivalent
43337
+ *
43338
+ * @example
43339
+ * ```typescript
43340
+ * const balance = await client.getGemBalance();
43341
+ * console.log(`You have ${balance.totalGems} gems (${balance.usdEquivalent} USD)`);
43342
+ * console.log(`${balance.expiringSoon} gems expiring soon`);
43343
+ * ```
43344
+ */
43345
+ async getGemBalance() {
43346
+ return this.get("/api/gems/balance");
43347
+ }
43348
+ /**
43349
+ * Get gem transaction history
43350
+ *
43351
+ * Returns paginated history of gem transactions including earning,
43352
+ * spending, and expiration events.
43353
+ *
43354
+ * @param params - Query parameters for filtering and pagination
43355
+ * @returns Paginated gem history
43356
+ *
43357
+ * @example
43358
+ * ```typescript
43359
+ * // Get all history
43360
+ * const history = await client.getGemHistory({ limit: 20, offset: 0 });
43361
+ *
43362
+ * // Get only earned gems
43363
+ * const earned = await client.getGemHistory({ type: "earn", limit: 10 });
43364
+ *
43365
+ * // Get only spent gems
43366
+ * const spent = await client.getGemHistory({ type: "spend", limit: 10 });
43367
+ *
43368
+ * history.items.forEach(item => {
43369
+ * console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
43370
+ * });
43371
+ * ```
43372
+ */
43373
+ async getGemHistory(params) {
43374
+ const queryString = params ? buildQueryString(params) : "";
43375
+ return this.get(`/api/gems/history${queryString}`);
43376
+ }
43377
+ /**
43378
+ * Get gems that are expiring soon
43379
+ *
43380
+ * Returns gem batches that will expire within the specified number of days.
43381
+ * Useful for prompting users to spend gems before they expire.
43382
+ *
43383
+ * @param params - Query parameters (days: default 30, max 180)
43384
+ * @returns Expiring gem batches with countdown info
43385
+ *
43386
+ * @example
43387
+ * ```typescript
43388
+ * // Get gems expiring in next 30 days (default)
43389
+ * const expiring = await client.getExpiringGems();
43390
+ *
43391
+ * // Get gems expiring in next 7 days
43392
+ * const urgent = await client.getExpiringGems({ days: 7 });
43393
+ *
43394
+ * if (expiring.totalExpiring > 0) {
43395
+ * console.log(`${expiring.totalExpiring} gems expiring soon!`);
43396
+ * expiring.batches.forEach(batch => {
43397
+ * console.log(`${batch.amount} gems expire in ${batch.daysUntilExpiry} days`);
43398
+ * });
43399
+ * }
43400
+ * ```
43401
+ */
43402
+ async getExpiringGems(params) {
43403
+ const queryString = params ? buildQueryString(params) : "";
43404
+ return this.get(`/api/gems/expiring${queryString}`);
43405
+ }
43406
+ // ============================================================================
43407
+ // Browsing Location API
43408
+ // ============================================================================
43409
+ /**
43410
+ * Get user's browsing location
43411
+ *
43412
+ * Returns the user's saved delivery location for geo-based product filtering.
43413
+ * This location is used to show products from merchants that ship to the area.
43414
+ *
43415
+ * @returns Current browsing location or null if not set
43416
+ *
43417
+ * @example
43418
+ * ```typescript
43419
+ * const result = await client.getBrowsingLocation();
43420
+ * if (result.location) {
43421
+ * console.log(`Delivery to: ${result.location.city}, ${result.location.country}`);
43422
+ * }
43423
+ * ```
43424
+ */
43425
+ async getBrowsingLocation() {
43426
+ return this.get("/api/user/browsing-location");
43427
+ }
43428
+ /**
43429
+ * Save user's browsing location
43430
+ *
43431
+ * Sets the user's delivery location for geo-based product filtering.
43432
+ * Products will be filtered to show only items from merchants that ship to this location.
43433
+ *
43434
+ * @param request - Location data from Google Places or manual input
43435
+ * @returns The saved location
43436
+ *
43437
+ * @example
43438
+ * ```typescript
43439
+ * const result = await client.saveBrowsingLocation({
43440
+ * formattedAddress: "Singapore, Singapore",
43441
+ * city: "Singapore",
43442
+ * country: "SG",
43443
+ * latitude: 1.3521,
43444
+ * longitude: 103.8198
43445
+ * });
43446
+ * console.log(`Location saved: ${result.location.formattedAddress}`);
43447
+ * ```
43448
+ */
43449
+ async saveBrowsingLocation(request) {
43450
+ return this.post("/api/user/browsing-location", request);
43451
+ }
43452
+ /**
43453
+ * Clear user's browsing location
43454
+ *
43455
+ * Removes the user's saved delivery location. Products will no longer
43456
+ * be filtered by shipping destination.
43457
+ *
43458
+ * @returns Success response
43459
+ *
43460
+ * @example
43461
+ * ```typescript
43462
+ * await client.clearBrowsingLocation();
43463
+ * console.log("Location cleared - showing all products");
43464
+ * ```
43465
+ */
43466
+ async clearBrowsingLocation() {
43467
+ return this.delete("/api/user/browsing-location");
43468
+ }
43268
43469
  };
43269
43470
 
43270
43471
  // lib/ecommerce/client/merchant.ts
@@ -43799,6 +44000,192 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
43799
44000
  return this.patch(`/api/marketplace/merchant/shipping/shipments/${shipmentId}`, request);
43800
44001
  }
43801
44002
  // ============================================================================
44003
+ // Shipping Settings (Zones & Rates)
44004
+ // ============================================================================
44005
+ /**
44006
+ * Get merchant shipping settings
44007
+ *
44008
+ * @returns Shipping settings
44009
+ *
44010
+ * @example
44011
+ * ```typescript
44012
+ * const { settings } = await client.getShippingSettings();
44013
+ * console.log("Handling fee:", settings.defaultHandlingFee);
44014
+ * ```
44015
+ */
44016
+ async getShippingSettings() {
44017
+ return this.get("/api/marketplace/merchant/shipping/settings");
44018
+ }
44019
+ /**
44020
+ * Update merchant shipping settings
44021
+ *
44022
+ * @param request - Settings to update
44023
+ * @returns Updated settings
44024
+ *
44025
+ * @example
44026
+ * ```typescript
44027
+ * await client.updateShippingSettings({
44028
+ * defaultHandlingFee: 2.50,
44029
+ * freeShippingEnabled: true,
44030
+ * freeShippingThreshold: 100
44031
+ * });
44032
+ * ```
44033
+ */
44034
+ async updateShippingSettings(request) {
44035
+ return this.post("/api/marketplace/merchant/shipping/settings", request);
44036
+ }
44037
+ /**
44038
+ * List all shipping zones
44039
+ *
44040
+ * @returns List of shipping zones with rate counts
44041
+ *
44042
+ * @example
44043
+ * ```typescript
44044
+ * const { zones } = await client.listShippingZones();
44045
+ * zones.forEach(z => console.log(z.name, z.countries.length, "countries"));
44046
+ * ```
44047
+ */
44048
+ async listShippingZones() {
44049
+ return this.get("/api/marketplace/merchant/shipping/zones");
44050
+ }
44051
+ /**
44052
+ * Get a shipping zone by ID
44053
+ *
44054
+ * @param zoneId - Zone ID
44055
+ * @returns Zone with rates
44056
+ *
44057
+ * @example
44058
+ * ```typescript
44059
+ * const { zone } = await client.getShippingZone("zone_123");
44060
+ * console.log(zone.name, zone.rates?.length, "rates");
44061
+ * ```
44062
+ */
44063
+ async getShippingZone(zoneId) {
44064
+ return this.get(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
44065
+ }
44066
+ /**
44067
+ * Create a shipping zone
44068
+ *
44069
+ * @param request - Zone data
44070
+ * @returns Created zone
44071
+ *
44072
+ * @example
44073
+ * ```typescript
44074
+ * const { zone } = await client.createShippingZone({
44075
+ * name: "Southeast Asia",
44076
+ * countries: ["SG", "MY", "TH", "ID", "PH", "VN"],
44077
+ * isDefault: false,
44078
+ * priority: 10
44079
+ * });
44080
+ * ```
44081
+ */
44082
+ async createShippingZone(request) {
44083
+ return this.post("/api/marketplace/merchant/shipping/zones", request);
44084
+ }
44085
+ /**
44086
+ * Update a shipping zone
44087
+ *
44088
+ * @param zoneId - Zone ID
44089
+ * @param request - Updated zone data
44090
+ * @returns Updated zone
44091
+ *
44092
+ * @example
44093
+ * ```typescript
44094
+ * await client.updateShippingZone("zone_123", {
44095
+ * countries: ["SG", "MY", "TH", "ID", "PH", "VN", "BN"]
44096
+ * });
44097
+ * ```
44098
+ */
44099
+ async updateShippingZone(zoneId, request) {
44100
+ return this.put(`/api/marketplace/merchant/shipping/zones/${zoneId}`, request);
44101
+ }
44102
+ /**
44103
+ * Delete a shipping zone
44104
+ *
44105
+ * @param zoneId - Zone ID
44106
+ * @returns Success response
44107
+ *
44108
+ * @example
44109
+ * ```typescript
44110
+ * await client.deleteShippingZone("zone_123");
44111
+ * ```
44112
+ */
44113
+ async deleteShippingZone(zoneId) {
44114
+ return this.delete(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
44115
+ }
44116
+ /**
44117
+ * List shipping rates
44118
+ *
44119
+ * @param zoneId - Optional zone ID to filter by
44120
+ * @returns List of shipping rates
44121
+ *
44122
+ * @example
44123
+ * ```typescript
44124
+ * // All rates
44125
+ * const { rates } = await client.listShippingRates();
44126
+ *
44127
+ * // Rates for a specific zone
44128
+ * const { rates: zoneRates } = await client.listShippingRates("zone_123");
44129
+ * ```
44130
+ */
44131
+ async listShippingRates(zoneId) {
44132
+ const query = zoneId ? `?zoneId=${zoneId}` : "";
44133
+ return this.get(`/api/marketplace/merchant/shipping/rates${query}`);
44134
+ }
44135
+ /**
44136
+ * Create a shipping rate
44137
+ *
44138
+ * @param request - Rate data
44139
+ * @returns Created rate
44140
+ *
44141
+ * @example
44142
+ * ```typescript
44143
+ * const { rate } = await client.createShippingRate({
44144
+ * zoneId: "zone_123",
44145
+ * name: "Standard Shipping",
44146
+ * baseRate: 5.00,
44147
+ * perKgRate: 1.50,
44148
+ * minDeliveryDays: 7,
44149
+ * maxDeliveryDays: 14
44150
+ * });
44151
+ * ```
44152
+ */
44153
+ async createShippingRate(request) {
44154
+ return this.post("/api/marketplace/merchant/shipping/rates", request);
44155
+ }
44156
+ /**
44157
+ * Update a shipping rate
44158
+ *
44159
+ * @param rateId - Rate ID
44160
+ * @param request - Updated rate data
44161
+ * @returns Updated rate
44162
+ *
44163
+ * @example
44164
+ * ```typescript
44165
+ * await client.updateShippingRate("rate_123", {
44166
+ * baseRate: 6.00,
44167
+ * freeAboveAmount: 75
44168
+ * });
44169
+ * ```
44170
+ */
44171
+ async updateShippingRate(rateId, request) {
44172
+ return this.put(`/api/marketplace/merchant/shipping/rates/${rateId}`, request);
44173
+ }
44174
+ /**
44175
+ * Delete a shipping rate
44176
+ *
44177
+ * @param rateId - Rate ID
44178
+ * @returns Success response
44179
+ *
44180
+ * @example
44181
+ * ```typescript
44182
+ * await client.deleteShippingRate("rate_123");
44183
+ * ```
44184
+ */
44185
+ async deleteShippingRate(rateId) {
44186
+ return this.delete(`/api/marketplace/merchant/shipping/rates/${rateId}`);
44187
+ }
44188
+ // ============================================================================
43802
44189
  // Returns & Refunds
43803
44190
  // ============================================================================
43804
44191
  /**
@@ -44396,6 +44783,223 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
44396
44783
  async exportTaxReport(reportId) {
44397
44784
  return this.get(`/api/marketplace/merchant/tax-reports/${reportId}/export`);
44398
44785
  }
44786
+ // ============================================
44787
+ // DROPSHIPPING APIs
44788
+ // ============================================
44789
+ /**
44790
+ * List connected dropship suppliers
44791
+ *
44792
+ * @returns Connected and available suppliers
44793
+ *
44794
+ * @example
44795
+ * ```typescript
44796
+ * const { connected, available } = await client.listDropshipSuppliers();
44797
+ * ```
44798
+ */
44799
+ async listDropshipSuppliers() {
44800
+ return this.get("/api/marketplace/merchant/dropship/suppliers");
44801
+ }
44802
+ /**
44803
+ * Connect a new dropship supplier
44804
+ *
44805
+ * @param request - Supplier credentials
44806
+ * @returns Connected supplier
44807
+ *
44808
+ * @example
44809
+ * ```typescript
44810
+ * const supplier = await client.connectDropshipSupplier({
44811
+ * code: "CJ_DROPSHIPPING",
44812
+ * apiKey: "your-api-key"
44813
+ * });
44814
+ * ```
44815
+ */
44816
+ async connectDropshipSupplier(request) {
44817
+ return this.post("/api/marketplace/merchant/dropship/suppliers", request);
44818
+ }
44819
+ /**
44820
+ * Update dropship supplier settings
44821
+ *
44822
+ * @param supplierId - Supplier ID
44823
+ * @param request - Settings to update
44824
+ * @returns Updated supplier
44825
+ */
44826
+ async updateDropshipSupplier(supplierId, request) {
44827
+ return this.put(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`, request);
44828
+ }
44829
+ /**
44830
+ * Disconnect a dropship supplier
44831
+ *
44832
+ * @param supplierId - Supplier ID
44833
+ */
44834
+ async disconnectDropshipSupplier(supplierId) {
44835
+ return this.delete(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`);
44836
+ }
44837
+ /**
44838
+ * Search products from connected suppliers
44839
+ *
44840
+ * @param request - Search parameters
44841
+ * @returns Search results with pagination
44842
+ *
44843
+ * @example
44844
+ * ```typescript
44845
+ * const results = await client.searchDropshipProducts({
44846
+ * supplierId: "supplier_123",
44847
+ * query: "wireless headphones",
44848
+ * limit: 20
44849
+ * });
44850
+ * ```
44851
+ */
44852
+ async searchDropshipProducts(request) {
44853
+ return this.post("/api/marketplace/merchant/dropship/search", request);
44854
+ }
44855
+ /**
44856
+ * Get dropship supplier categories
44857
+ *
44858
+ * @param supplierId - Supplier ID
44859
+ * @returns Category list
44860
+ */
44861
+ async getDropshipCategories(supplierId) {
44862
+ return this.get(`/api/marketplace/merchant/dropship/categories?supplierId=${supplierId}`);
44863
+ }
44864
+ /**
44865
+ * Get detailed product info from supplier
44866
+ *
44867
+ * @param supplierId - Supplier ID
44868
+ * @param externalProductId - Supplier's product ID
44869
+ * @returns Product details with suggested pricing
44870
+ */
44871
+ async getDropshipProductDetails(supplierId, externalProductId) {
44872
+ return this.get(
44873
+ `/api/marketplace/merchant/dropship/products/${encodeURIComponent(externalProductId)}?supplierId=${supplierId}`
44874
+ );
44875
+ }
44876
+ /**
44877
+ * Import a product from supplier to your store
44878
+ *
44879
+ * @param request - Import parameters
44880
+ * @returns Created product IDs
44881
+ *
44882
+ * @example
44883
+ * ```typescript
44884
+ * const result = await client.importDropshipProduct({
44885
+ * supplierId: "supplier_123",
44886
+ * externalProductId: "ext_product_456",
44887
+ * priceUSDC: 29.99,
44888
+ * title: "Custom Title"
44889
+ * });
44890
+ * ```
44891
+ */
44892
+ async importDropshipProduct(request) {
44893
+ return this.post("/api/marketplace/merchant/dropship/import", request);
44894
+ }
44895
+ /**
44896
+ * Bulk import products from supplier
44897
+ *
44898
+ * @param request - Bulk import parameters
44899
+ * @returns Import results
44900
+ */
44901
+ async bulkImportDropshipProducts(request) {
44902
+ return this.post("/api/marketplace/merchant/dropship/import", request);
44903
+ }
44904
+ /**
44905
+ * List imported dropship products
44906
+ *
44907
+ * @param params - Filter parameters
44908
+ * @returns Imported products list
44909
+ */
44910
+ async listDropshipProducts(params) {
44911
+ const query = params ? `?${buildQueryString(params)}` : "";
44912
+ return this.get(`/api/marketplace/merchant/dropship/import${query}`);
44913
+ }
44914
+ /**
44915
+ * List dropship order links
44916
+ *
44917
+ * @param params - Filter parameters
44918
+ * @returns Order links with status summary
44919
+ */
44920
+ async listDropshipOrders(params) {
44921
+ let query = "";
44922
+ if (params) {
44923
+ const queryParams = {};
44924
+ if (params.status) {
44925
+ queryParams.status = Array.isArray(params.status) ? params.status.join(",") : params.status;
44926
+ }
44927
+ if (params.limit) queryParams.limit = params.limit.toString();
44928
+ if (params.offset) queryParams.offset = params.offset.toString();
44929
+ query = `?${buildQueryString(queryParams)}`;
44930
+ }
44931
+ return this.get(`/api/marketplace/merchant/dropship/orders${query}`);
44932
+ }
44933
+ /**
44934
+ * Forward orders to supplier
44935
+ *
44936
+ * @param orderItemIds - Order item IDs to forward
44937
+ * @returns Forward results
44938
+ */
44939
+ async forwardDropshipOrders(orderItemIds) {
44940
+ return this.post("/api/marketplace/merchant/dropship/orders", {
44941
+ action: "forward",
44942
+ orderItemIds
44943
+ });
44944
+ }
44945
+ /**
44946
+ * Sync tracking for all pending dropship orders
44947
+ *
44948
+ * @returns Sync results
44949
+ */
44950
+ async syncDropshipTracking() {
44951
+ return this.post("/api/marketplace/merchant/dropship/orders", {
44952
+ action: "sync"
44953
+ });
44954
+ }
44955
+ /**
44956
+ * Get order forwarding details for manual forwarding
44957
+ *
44958
+ * @param orderItemId - Order item ID
44959
+ * @returns Forwarding details
44960
+ */
44961
+ async getDropshipOrderDetails(orderItemId) {
44962
+ return this.get(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`);
44963
+ }
44964
+ /**
44965
+ * Forward a single order item to supplier
44966
+ *
44967
+ * @param orderItemId - Order item ID
44968
+ * @returns Forward result
44969
+ */
44970
+ async forwardDropshipOrder(orderItemId) {
44971
+ return this.post(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`, {});
44972
+ }
44973
+ /**
44974
+ * Get dropship settings
44975
+ *
44976
+ * @returns Merchant dropship settings
44977
+ */
44978
+ async getDropshipSettings() {
44979
+ return this.get("/api/marketplace/merchant/dropship/settings");
44980
+ }
44981
+ /**
44982
+ * Update dropship settings
44983
+ *
44984
+ * @param request - Settings to update
44985
+ * @returns Updated settings
44986
+ */
44987
+ async updateDropshipSettings(request) {
44988
+ return this.put("/api/marketplace/merchant/dropship/settings", request);
44989
+ }
44990
+ /**
44991
+ * Sync dropship products and/or orders
44992
+ *
44993
+ * @param type - Sync type (products, orders, all, single)
44994
+ * @param dropshipProductId - For single product sync
44995
+ * @returns Sync results
44996
+ */
44997
+ async syncDropship(type, dropshipProductId) {
44998
+ return this.post("/api/marketplace/merchant/dropship/sync", {
44999
+ type,
45000
+ dropshipProductId
45001
+ });
45002
+ }
44399
45003
  };
44400
45004
 
44401
45005
  // lib/ecommerce/types/enums.ts
@@ -44413,6 +45017,8 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
44413
45017
  })(OrderStatus || {});
44414
45018
  var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
44415
45019
  PaymentMethod2["USDC_ESCROW"] = "USDC_ESCROW";
45020
+ PaymentMethod2["BASEDPAY"] = "BASEDPAY";
45021
+ PaymentMethod2["STRIPE"] = "STRIPE";
44416
45022
  PaymentMethod2["POINTS"] = "POINTS";
44417
45023
  return PaymentMethod2;
44418
45024
  })(PaymentMethod || {});
@@ -44523,6 +45129,7 @@ var ProductSortBy = /* @__PURE__ */ ((ProductSortBy2) => {
44523
45129
  ProductSortBy2["PRICE_DESC"] = "price_desc";
44524
45130
  ProductSortBy2["POPULAR"] = "popular";
44525
45131
  ProductSortBy2["FEATURED"] = "featured";
45132
+ ProductSortBy2["NEARBY"] = "nearby";
44526
45133
  return ProductSortBy2;
44527
45134
  })(ProductSortBy || {});
44528
45135
  var ReviewSortBy = /* @__PURE__ */ ((ReviewSortBy2) => {
@@ -44605,6 +45212,7 @@ exports.getNextTierInfo = getNextTierInfo;
44605
45212
  exports.getPriceDecimals = getPriceDecimals;
44606
45213
  exports.getStaticCollateralTokenByDex = getStaticCollateralTokenByDex;
44607
45214
  exports.getStaticCollateralTokenSymbol = getStaticCollateralTokenSymbol;
45215
+ exports.getWeekInfoFromNumber = getWeekInfoFromNumber;
44608
45216
  exports.getWidgetTypeById = getWidgetTypeById;
44609
45217
  exports.isBasedCloid = isBasedCloid;
44610
45218
  exports.isClientCode = isClientCode;
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { BannerType, BaseEcommerceClient, CustomerEcommerceClient, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, InventoryAuditAction, MerchantEcommerceClient, MerchantStatus, OrderStatus, PaymentMethod, PaymentStatus, ProductSortBy, ReturnStatus, ReviewSortBy, ReviewStatus, ShipmentStatus, SortOrder, TaxBehavior, TaxReportPeriodType, TaxReportStatus, TaxType, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './chunk-Z5OW2FDP.mjs';
1
+ export { BannerType, BaseEcommerceClient, CustomerEcommerceClient, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, InventoryAuditAction, MerchantEcommerceClient, MerchantStatus, OrderStatus, PaymentMethod, PaymentStatus, ProductSortBy, ReturnStatus, ReviewSortBy, ReviewStatus, ShipmentStatus, SortOrder, TaxBehavior, TaxReportPeriodType, TaxReportStatus, TaxType, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress } from './chunk-NVL2HX2H.mjs';
2
2
  export { AssetIdUtils, InstrumentClient } from './chunk-VBC6EQ7Q.mjs';
3
3
  import { __glob } from './chunk-4UEJOM6W.mjs';
4
4
  import Decimal, { Decimal as Decimal$1 } from 'decimal.js';
@@ -1297,6 +1297,12 @@ function getLatestCompletedWeek(currentTimestamp, offset = 0, weekStartsOn = 4 /
1297
1297
  const weekNumber = Math.round(msSinceWeek1 / WEEK_IN_MS) + 1;
1298
1298
  return { weekNumber, startDate, endDate };
1299
1299
  }
1300
+ function getWeekInfoFromNumber(weekNumber, weekStartsOn = 4 /* Thursday */) {
1301
+ const week1StartDate = new Date(process.env.WEEK1_START_DATE || "2025-12-04T00:00:00Z");
1302
+ const startDate = new Date(week1StartDate.getTime() + (weekNumber - 1) * WEEK_IN_MS);
1303
+ const endDate = new Date(startDate.getTime() + WEEK_IN_MS);
1304
+ return { weekNumber, startDate, endDate };
1305
+ }
1300
1306
 
1301
1307
  // lib/hip3/market-info.ts
1302
1308
  async function getAllPerpsMeta(infoClient) {
@@ -1305,4 +1311,4 @@ async function getAllPerpsMeta(infoClient) {
1305
1311
  });
1306
1312
  }
1307
1313
 
1308
- export { CloidClientCode, CloidClientCodeNameById, DayOfWeek, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, USDC_SPOT_TOKEN, UserDexAbstractionTypes, WidgetType, WidgetTypeById, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, 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 };
1314
+ export { CloidClientCode, CloidClientCodeNameById, DayOfWeek, MetadataClient, PUP_TOKEN_ADDRESS, PUP_TOKEN_THRESHOLDS, ROOT_DEX, TARGET_APPROVED_MAX_BUILDER_FEE, TARGET_APPROVED_MAX_BUILDER_FEE_PERCENT, TESTNET_USDC_SPOT_TOKEN, USDC_SPOT_TOKEN, UserDexAbstractionTypes, WidgetType, WidgetTypeById, XP_BOOST_PERCENTAGES, buildCloid, calculateBoostPercentage, calculateTotalPupAmount, decodeSlug, enableHip3DexAbstractionWithAgent, encodeSlug, floorUtcDay, floorUtcHour, floorUtcMinutes, floorUtcWeek, formatPriceAndSize, formatPriceForDisplay, formatPriceForOrder, formatSizeForDisplay, formatSizeForOrder, getAllPerpsMeta, 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 };