@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/{chunk-MVFO4WRF.mjs → chunk-SKX4VGEN.mjs} +573 -1
- package/dist/ecommerce.d.mts +1220 -7
- package/dist/ecommerce.d.ts +1220 -7
- package/dist/ecommerce.js +573 -1
- package/dist/ecommerce.mjs +1 -1
- package/dist/index.d.mts +12 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +580 -1
- package/dist/index.mjs +8 -2
- package/lib/ecommerce/QUICK_REFERENCE.md +26 -0
- package/lib/ecommerce/README.md +26 -0
- package/lib/ecommerce/client/base.ts +7 -1
- package/lib/ecommerce/client/customer.ts +190 -0
- package/lib/ecommerce/client/merchant.ts +783 -0
- package/lib/ecommerce/types/entities.ts +94 -0
- package/lib/ecommerce/types/enums.ts +5 -1
- package/lib/ecommerce/types/requests.ts +122 -0
- package/lib/ecommerce/types/responses.ts +244 -0
- package/lib/utils/formatter.ts +1 -1
- package/lib/utils/time.ts +24 -0
- package/package.json +3 -2
|
@@ -130,11 +130,13 @@ var BaseEcommerceClient = class {
|
|
|
130
130
|
maxRetries: config.maxRetries || 3,
|
|
131
131
|
retryBaseDelay: config.retryBaseDelay || 1e3,
|
|
132
132
|
headers: config.headers,
|
|
133
|
-
enableRetry: config.enableRetry !== false
|
|
133
|
+
enableRetry: config.enableRetry !== false,
|
|
134
|
+
withCredentials: config.withCredentials || false
|
|
134
135
|
};
|
|
135
136
|
this.axiosInstance = axios.create({
|
|
136
137
|
baseURL: this.config.baseURL,
|
|
137
138
|
timeout: this.config.timeout,
|
|
139
|
+
withCredentials: this.config.withCredentials,
|
|
138
140
|
headers: {
|
|
139
141
|
"Content-Type": "application/json",
|
|
140
142
|
...this.config.headers
|
|
@@ -678,6 +680,34 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
678
680
|
return this.post("/api/marketplace/tax/calculate", request);
|
|
679
681
|
}
|
|
680
682
|
// ============================================================================
|
|
683
|
+
// Shipping Calculation API
|
|
684
|
+
// ============================================================================
|
|
685
|
+
/**
|
|
686
|
+
* Calculate shipping options for cart items
|
|
687
|
+
*
|
|
688
|
+
* @param request - Cart items, merchant, and destination
|
|
689
|
+
* @returns Available shipping options with costs
|
|
690
|
+
*
|
|
691
|
+
* @example
|
|
692
|
+
* ```typescript
|
|
693
|
+
* const result = await client.calculateShippingOptions({
|
|
694
|
+
* merchantId: "merchant_123",
|
|
695
|
+
* cartItems: [
|
|
696
|
+
* { productId: "prod_123", quantity: 2 }
|
|
697
|
+
* ],
|
|
698
|
+
* destinationCountry: "US",
|
|
699
|
+
* orderSubtotal: 99.99
|
|
700
|
+
* });
|
|
701
|
+
*
|
|
702
|
+
* result.shippingOptions.forEach(opt => {
|
|
703
|
+
* console.log(opt.name, opt.cost, opt.estimatedDelivery);
|
|
704
|
+
* });
|
|
705
|
+
* ```
|
|
706
|
+
*/
|
|
707
|
+
async calculateShippingOptions(request) {
|
|
708
|
+
return this.post("/api/marketplace/shipping/calculate", request);
|
|
709
|
+
}
|
|
710
|
+
// ============================================================================
|
|
681
711
|
// Banners API
|
|
682
712
|
// ============================================================================
|
|
683
713
|
/**
|
|
@@ -821,6 +851,143 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
821
851
|
const queryString = params ? buildQueryString(params) : "";
|
|
822
852
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
823
853
|
}
|
|
854
|
+
// ============================================================================
|
|
855
|
+
// Merchant Storefront API
|
|
856
|
+
// ============================================================================
|
|
857
|
+
/**
|
|
858
|
+
* Get public merchant profile
|
|
859
|
+
*
|
|
860
|
+
* Fetches public information about a merchant for the storefront page.
|
|
861
|
+
*
|
|
862
|
+
* @param merchantId - Merchant ID
|
|
863
|
+
* @returns Public merchant profile with stats
|
|
864
|
+
*
|
|
865
|
+
* @example
|
|
866
|
+
* ```typescript
|
|
867
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
868
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
869
|
+
* ```
|
|
870
|
+
*/
|
|
871
|
+
async getMerchantProfile(merchantId) {
|
|
872
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
873
|
+
}
|
|
874
|
+
/**
|
|
875
|
+
* List merchant products
|
|
876
|
+
*
|
|
877
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
878
|
+
*
|
|
879
|
+
* @param merchantId - Merchant ID
|
|
880
|
+
* @param params - Query parameters for filtering and pagination
|
|
881
|
+
* @returns Paginated list of products
|
|
882
|
+
*
|
|
883
|
+
* @example
|
|
884
|
+
* ```typescript
|
|
885
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
886
|
+
* search: "laptop",
|
|
887
|
+
* sortBy: "popular",
|
|
888
|
+
* limit: 20,
|
|
889
|
+
* });
|
|
890
|
+
*
|
|
891
|
+
* result.items.forEach(product => {
|
|
892
|
+
* console.log(product.title, product.priceUSDC);
|
|
893
|
+
* });
|
|
894
|
+
* ```
|
|
895
|
+
*/
|
|
896
|
+
async getMerchantProducts(merchantId, params) {
|
|
897
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
898
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
899
|
+
}
|
|
900
|
+
// ============================================================================
|
|
901
|
+
// Shop Following API
|
|
902
|
+
// ============================================================================
|
|
903
|
+
/**
|
|
904
|
+
* Check if following a merchant
|
|
905
|
+
*
|
|
906
|
+
* @param merchantId - Merchant ID
|
|
907
|
+
* @returns Follow status with follow date if applicable
|
|
908
|
+
*
|
|
909
|
+
* @example
|
|
910
|
+
* ```typescript
|
|
911
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
912
|
+
* if (status.isFollowing) {
|
|
913
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
914
|
+
* }
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
async isFollowingMerchant(merchantId) {
|
|
918
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Follow a merchant
|
|
922
|
+
*
|
|
923
|
+
* @param merchantId - Merchant ID to follow
|
|
924
|
+
* @returns Follow action result
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```typescript
|
|
928
|
+
* const result = await client.followMerchant("merchant_123");
|
|
929
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
930
|
+
* ```
|
|
931
|
+
*/
|
|
932
|
+
async followMerchant(merchantId) {
|
|
933
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
934
|
+
}
|
|
935
|
+
/**
|
|
936
|
+
* Unfollow a merchant
|
|
937
|
+
*
|
|
938
|
+
* @param merchantId - Merchant ID to unfollow
|
|
939
|
+
* @returns Unfollow action result
|
|
940
|
+
*
|
|
941
|
+
* @example
|
|
942
|
+
* ```typescript
|
|
943
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
944
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
945
|
+
* ```
|
|
946
|
+
*/
|
|
947
|
+
async unfollowMerchant(merchantId) {
|
|
948
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
949
|
+
}
|
|
950
|
+
/**
|
|
951
|
+
* Get list of followed merchants
|
|
952
|
+
*
|
|
953
|
+
* @param params - Query parameters for pagination and sorting
|
|
954
|
+
* @returns Paginated list of followed merchants with their info
|
|
955
|
+
*
|
|
956
|
+
* @example
|
|
957
|
+
* ```typescript
|
|
958
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
959
|
+
* result.items.forEach(item => {
|
|
960
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
961
|
+
* });
|
|
962
|
+
* ```
|
|
963
|
+
*/
|
|
964
|
+
async getFollowedMerchants(params) {
|
|
965
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
966
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
967
|
+
}
|
|
968
|
+
// ============================================================================
|
|
969
|
+
// Payment Methods
|
|
970
|
+
// ============================================================================
|
|
971
|
+
/**
|
|
972
|
+
* Get available payment methods
|
|
973
|
+
*
|
|
974
|
+
* Returns the list of enabled payment methods that can be used during checkout.
|
|
975
|
+
*
|
|
976
|
+
* @returns List of available payment methods with display info
|
|
977
|
+
*
|
|
978
|
+
* @example
|
|
979
|
+
* ```typescript
|
|
980
|
+
* const result = await client.getPaymentMethods();
|
|
981
|
+
* if (result.paymentsEnabled) {
|
|
982
|
+
* result.methods.forEach(method => {
|
|
983
|
+
* console.log(`${method.name}: ${method.description}`);
|
|
984
|
+
* });
|
|
985
|
+
* }
|
|
986
|
+
* ```
|
|
987
|
+
*/
|
|
988
|
+
async getPaymentMethods() {
|
|
989
|
+
return this.get("/api/marketplace/payments/methods");
|
|
990
|
+
}
|
|
824
991
|
};
|
|
825
992
|
|
|
826
993
|
// lib/ecommerce/client/merchant.ts
|
|
@@ -1355,6 +1522,192 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
|
|
|
1355
1522
|
return this.patch(`/api/marketplace/merchant/shipping/shipments/${shipmentId}`, request);
|
|
1356
1523
|
}
|
|
1357
1524
|
// ============================================================================
|
|
1525
|
+
// Shipping Settings (Zones & Rates)
|
|
1526
|
+
// ============================================================================
|
|
1527
|
+
/**
|
|
1528
|
+
* Get merchant shipping settings
|
|
1529
|
+
*
|
|
1530
|
+
* @returns Shipping settings
|
|
1531
|
+
*
|
|
1532
|
+
* @example
|
|
1533
|
+
* ```typescript
|
|
1534
|
+
* const { settings } = await client.getShippingSettings();
|
|
1535
|
+
* console.log("Handling fee:", settings.defaultHandlingFee);
|
|
1536
|
+
* ```
|
|
1537
|
+
*/
|
|
1538
|
+
async getShippingSettings() {
|
|
1539
|
+
return this.get("/api/marketplace/merchant/shipping/settings");
|
|
1540
|
+
}
|
|
1541
|
+
/**
|
|
1542
|
+
* Update merchant shipping settings
|
|
1543
|
+
*
|
|
1544
|
+
* @param request - Settings to update
|
|
1545
|
+
* @returns Updated settings
|
|
1546
|
+
*
|
|
1547
|
+
* @example
|
|
1548
|
+
* ```typescript
|
|
1549
|
+
* await client.updateShippingSettings({
|
|
1550
|
+
* defaultHandlingFee: 2.50,
|
|
1551
|
+
* freeShippingEnabled: true,
|
|
1552
|
+
* freeShippingThreshold: 100
|
|
1553
|
+
* });
|
|
1554
|
+
* ```
|
|
1555
|
+
*/
|
|
1556
|
+
async updateShippingSettings(request) {
|
|
1557
|
+
return this.post("/api/marketplace/merchant/shipping/settings", request);
|
|
1558
|
+
}
|
|
1559
|
+
/**
|
|
1560
|
+
* List all shipping zones
|
|
1561
|
+
*
|
|
1562
|
+
* @returns List of shipping zones with rate counts
|
|
1563
|
+
*
|
|
1564
|
+
* @example
|
|
1565
|
+
* ```typescript
|
|
1566
|
+
* const { zones } = await client.listShippingZones();
|
|
1567
|
+
* zones.forEach(z => console.log(z.name, z.countries.length, "countries"));
|
|
1568
|
+
* ```
|
|
1569
|
+
*/
|
|
1570
|
+
async listShippingZones() {
|
|
1571
|
+
return this.get("/api/marketplace/merchant/shipping/zones");
|
|
1572
|
+
}
|
|
1573
|
+
/**
|
|
1574
|
+
* Get a shipping zone by ID
|
|
1575
|
+
*
|
|
1576
|
+
* @param zoneId - Zone ID
|
|
1577
|
+
* @returns Zone with rates
|
|
1578
|
+
*
|
|
1579
|
+
* @example
|
|
1580
|
+
* ```typescript
|
|
1581
|
+
* const { zone } = await client.getShippingZone("zone_123");
|
|
1582
|
+
* console.log(zone.name, zone.rates?.length, "rates");
|
|
1583
|
+
* ```
|
|
1584
|
+
*/
|
|
1585
|
+
async getShippingZone(zoneId) {
|
|
1586
|
+
return this.get(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
|
|
1587
|
+
}
|
|
1588
|
+
/**
|
|
1589
|
+
* Create a shipping zone
|
|
1590
|
+
*
|
|
1591
|
+
* @param request - Zone data
|
|
1592
|
+
* @returns Created zone
|
|
1593
|
+
*
|
|
1594
|
+
* @example
|
|
1595
|
+
* ```typescript
|
|
1596
|
+
* const { zone } = await client.createShippingZone({
|
|
1597
|
+
* name: "Southeast Asia",
|
|
1598
|
+
* countries: ["SG", "MY", "TH", "ID", "PH", "VN"],
|
|
1599
|
+
* isDefault: false,
|
|
1600
|
+
* priority: 10
|
|
1601
|
+
* });
|
|
1602
|
+
* ```
|
|
1603
|
+
*/
|
|
1604
|
+
async createShippingZone(request) {
|
|
1605
|
+
return this.post("/api/marketplace/merchant/shipping/zones", request);
|
|
1606
|
+
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Update a shipping zone
|
|
1609
|
+
*
|
|
1610
|
+
* @param zoneId - Zone ID
|
|
1611
|
+
* @param request - Updated zone data
|
|
1612
|
+
* @returns Updated zone
|
|
1613
|
+
*
|
|
1614
|
+
* @example
|
|
1615
|
+
* ```typescript
|
|
1616
|
+
* await client.updateShippingZone("zone_123", {
|
|
1617
|
+
* countries: ["SG", "MY", "TH", "ID", "PH", "VN", "BN"]
|
|
1618
|
+
* });
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
async updateShippingZone(zoneId, request) {
|
|
1622
|
+
return this.put(`/api/marketplace/merchant/shipping/zones/${zoneId}`, request);
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Delete a shipping zone
|
|
1626
|
+
*
|
|
1627
|
+
* @param zoneId - Zone ID
|
|
1628
|
+
* @returns Success response
|
|
1629
|
+
*
|
|
1630
|
+
* @example
|
|
1631
|
+
* ```typescript
|
|
1632
|
+
* await client.deleteShippingZone("zone_123");
|
|
1633
|
+
* ```
|
|
1634
|
+
*/
|
|
1635
|
+
async deleteShippingZone(zoneId) {
|
|
1636
|
+
return this.delete(`/api/marketplace/merchant/shipping/zones/${zoneId}`);
|
|
1637
|
+
}
|
|
1638
|
+
/**
|
|
1639
|
+
* List shipping rates
|
|
1640
|
+
*
|
|
1641
|
+
* @param zoneId - Optional zone ID to filter by
|
|
1642
|
+
* @returns List of shipping rates
|
|
1643
|
+
*
|
|
1644
|
+
* @example
|
|
1645
|
+
* ```typescript
|
|
1646
|
+
* // All rates
|
|
1647
|
+
* const { rates } = await client.listShippingRates();
|
|
1648
|
+
*
|
|
1649
|
+
* // Rates for a specific zone
|
|
1650
|
+
* const { rates: zoneRates } = await client.listShippingRates("zone_123");
|
|
1651
|
+
* ```
|
|
1652
|
+
*/
|
|
1653
|
+
async listShippingRates(zoneId) {
|
|
1654
|
+
const query = zoneId ? `?zoneId=${zoneId}` : "";
|
|
1655
|
+
return this.get(`/api/marketplace/merchant/shipping/rates${query}`);
|
|
1656
|
+
}
|
|
1657
|
+
/**
|
|
1658
|
+
* Create a shipping rate
|
|
1659
|
+
*
|
|
1660
|
+
* @param request - Rate data
|
|
1661
|
+
* @returns Created rate
|
|
1662
|
+
*
|
|
1663
|
+
* @example
|
|
1664
|
+
* ```typescript
|
|
1665
|
+
* const { rate } = await client.createShippingRate({
|
|
1666
|
+
* zoneId: "zone_123",
|
|
1667
|
+
* name: "Standard Shipping",
|
|
1668
|
+
* baseRate: 5.00,
|
|
1669
|
+
* perKgRate: 1.50,
|
|
1670
|
+
* minDeliveryDays: 7,
|
|
1671
|
+
* maxDeliveryDays: 14
|
|
1672
|
+
* });
|
|
1673
|
+
* ```
|
|
1674
|
+
*/
|
|
1675
|
+
async createShippingRate(request) {
|
|
1676
|
+
return this.post("/api/marketplace/merchant/shipping/rates", request);
|
|
1677
|
+
}
|
|
1678
|
+
/**
|
|
1679
|
+
* Update a shipping rate
|
|
1680
|
+
*
|
|
1681
|
+
* @param rateId - Rate ID
|
|
1682
|
+
* @param request - Updated rate data
|
|
1683
|
+
* @returns Updated rate
|
|
1684
|
+
*
|
|
1685
|
+
* @example
|
|
1686
|
+
* ```typescript
|
|
1687
|
+
* await client.updateShippingRate("rate_123", {
|
|
1688
|
+
* baseRate: 6.00,
|
|
1689
|
+
* freeAboveAmount: 75
|
|
1690
|
+
* });
|
|
1691
|
+
* ```
|
|
1692
|
+
*/
|
|
1693
|
+
async updateShippingRate(rateId, request) {
|
|
1694
|
+
return this.put(`/api/marketplace/merchant/shipping/rates/${rateId}`, request);
|
|
1695
|
+
}
|
|
1696
|
+
/**
|
|
1697
|
+
* Delete a shipping rate
|
|
1698
|
+
*
|
|
1699
|
+
* @param rateId - Rate ID
|
|
1700
|
+
* @returns Success response
|
|
1701
|
+
*
|
|
1702
|
+
* @example
|
|
1703
|
+
* ```typescript
|
|
1704
|
+
* await client.deleteShippingRate("rate_123");
|
|
1705
|
+
* ```
|
|
1706
|
+
*/
|
|
1707
|
+
async deleteShippingRate(rateId) {
|
|
1708
|
+
return this.delete(`/api/marketplace/merchant/shipping/rates/${rateId}`);
|
|
1709
|
+
}
|
|
1710
|
+
// ============================================================================
|
|
1358
1711
|
// Returns & Refunds
|
|
1359
1712
|
// ============================================================================
|
|
1360
1713
|
/**
|
|
@@ -1952,6 +2305,223 @@ var MerchantEcommerceClient = class extends BaseEcommerceClient {
|
|
|
1952
2305
|
async exportTaxReport(reportId) {
|
|
1953
2306
|
return this.get(`/api/marketplace/merchant/tax-reports/${reportId}/export`);
|
|
1954
2307
|
}
|
|
2308
|
+
// ============================================
|
|
2309
|
+
// DROPSHIPPING APIs
|
|
2310
|
+
// ============================================
|
|
2311
|
+
/**
|
|
2312
|
+
* List connected dropship suppliers
|
|
2313
|
+
*
|
|
2314
|
+
* @returns Connected and available suppliers
|
|
2315
|
+
*
|
|
2316
|
+
* @example
|
|
2317
|
+
* ```typescript
|
|
2318
|
+
* const { connected, available } = await client.listDropshipSuppliers();
|
|
2319
|
+
* ```
|
|
2320
|
+
*/
|
|
2321
|
+
async listDropshipSuppliers() {
|
|
2322
|
+
return this.get("/api/marketplace/merchant/dropship/suppliers");
|
|
2323
|
+
}
|
|
2324
|
+
/**
|
|
2325
|
+
* Connect a new dropship supplier
|
|
2326
|
+
*
|
|
2327
|
+
* @param request - Supplier credentials
|
|
2328
|
+
* @returns Connected supplier
|
|
2329
|
+
*
|
|
2330
|
+
* @example
|
|
2331
|
+
* ```typescript
|
|
2332
|
+
* const supplier = await client.connectDropshipSupplier({
|
|
2333
|
+
* code: "CJ_DROPSHIPPING",
|
|
2334
|
+
* apiKey: "your-api-key"
|
|
2335
|
+
* });
|
|
2336
|
+
* ```
|
|
2337
|
+
*/
|
|
2338
|
+
async connectDropshipSupplier(request) {
|
|
2339
|
+
return this.post("/api/marketplace/merchant/dropship/suppliers", request);
|
|
2340
|
+
}
|
|
2341
|
+
/**
|
|
2342
|
+
* Update dropship supplier settings
|
|
2343
|
+
*
|
|
2344
|
+
* @param supplierId - Supplier ID
|
|
2345
|
+
* @param request - Settings to update
|
|
2346
|
+
* @returns Updated supplier
|
|
2347
|
+
*/
|
|
2348
|
+
async updateDropshipSupplier(supplierId, request) {
|
|
2349
|
+
return this.put(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`, request);
|
|
2350
|
+
}
|
|
2351
|
+
/**
|
|
2352
|
+
* Disconnect a dropship supplier
|
|
2353
|
+
*
|
|
2354
|
+
* @param supplierId - Supplier ID
|
|
2355
|
+
*/
|
|
2356
|
+
async disconnectDropshipSupplier(supplierId) {
|
|
2357
|
+
return this.delete(`/api/marketplace/merchant/dropship/suppliers/${supplierId}`);
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Search products from connected suppliers
|
|
2361
|
+
*
|
|
2362
|
+
* @param request - Search parameters
|
|
2363
|
+
* @returns Search results with pagination
|
|
2364
|
+
*
|
|
2365
|
+
* @example
|
|
2366
|
+
* ```typescript
|
|
2367
|
+
* const results = await client.searchDropshipProducts({
|
|
2368
|
+
* supplierId: "supplier_123",
|
|
2369
|
+
* query: "wireless headphones",
|
|
2370
|
+
* limit: 20
|
|
2371
|
+
* });
|
|
2372
|
+
* ```
|
|
2373
|
+
*/
|
|
2374
|
+
async searchDropshipProducts(request) {
|
|
2375
|
+
return this.post("/api/marketplace/merchant/dropship/search", request);
|
|
2376
|
+
}
|
|
2377
|
+
/**
|
|
2378
|
+
* Get dropship supplier categories
|
|
2379
|
+
*
|
|
2380
|
+
* @param supplierId - Supplier ID
|
|
2381
|
+
* @returns Category list
|
|
2382
|
+
*/
|
|
2383
|
+
async getDropshipCategories(supplierId) {
|
|
2384
|
+
return this.get(`/api/marketplace/merchant/dropship/categories?supplierId=${supplierId}`);
|
|
2385
|
+
}
|
|
2386
|
+
/**
|
|
2387
|
+
* Get detailed product info from supplier
|
|
2388
|
+
*
|
|
2389
|
+
* @param supplierId - Supplier ID
|
|
2390
|
+
* @param externalProductId - Supplier's product ID
|
|
2391
|
+
* @returns Product details with suggested pricing
|
|
2392
|
+
*/
|
|
2393
|
+
async getDropshipProductDetails(supplierId, externalProductId) {
|
|
2394
|
+
return this.get(
|
|
2395
|
+
`/api/marketplace/merchant/dropship/products/${encodeURIComponent(externalProductId)}?supplierId=${supplierId}`
|
|
2396
|
+
);
|
|
2397
|
+
}
|
|
2398
|
+
/**
|
|
2399
|
+
* Import a product from supplier to your store
|
|
2400
|
+
*
|
|
2401
|
+
* @param request - Import parameters
|
|
2402
|
+
* @returns Created product IDs
|
|
2403
|
+
*
|
|
2404
|
+
* @example
|
|
2405
|
+
* ```typescript
|
|
2406
|
+
* const result = await client.importDropshipProduct({
|
|
2407
|
+
* supplierId: "supplier_123",
|
|
2408
|
+
* externalProductId: "ext_product_456",
|
|
2409
|
+
* priceUSDC: 29.99,
|
|
2410
|
+
* title: "Custom Title"
|
|
2411
|
+
* });
|
|
2412
|
+
* ```
|
|
2413
|
+
*/
|
|
2414
|
+
async importDropshipProduct(request) {
|
|
2415
|
+
return this.post("/api/marketplace/merchant/dropship/import", request);
|
|
2416
|
+
}
|
|
2417
|
+
/**
|
|
2418
|
+
* Bulk import products from supplier
|
|
2419
|
+
*
|
|
2420
|
+
* @param request - Bulk import parameters
|
|
2421
|
+
* @returns Import results
|
|
2422
|
+
*/
|
|
2423
|
+
async bulkImportDropshipProducts(request) {
|
|
2424
|
+
return this.post("/api/marketplace/merchant/dropship/import", request);
|
|
2425
|
+
}
|
|
2426
|
+
/**
|
|
2427
|
+
* List imported dropship products
|
|
2428
|
+
*
|
|
2429
|
+
* @param params - Filter parameters
|
|
2430
|
+
* @returns Imported products list
|
|
2431
|
+
*/
|
|
2432
|
+
async listDropshipProducts(params) {
|
|
2433
|
+
const query = params ? `?${buildQueryString(params)}` : "";
|
|
2434
|
+
return this.get(`/api/marketplace/merchant/dropship/import${query}`);
|
|
2435
|
+
}
|
|
2436
|
+
/**
|
|
2437
|
+
* List dropship order links
|
|
2438
|
+
*
|
|
2439
|
+
* @param params - Filter parameters
|
|
2440
|
+
* @returns Order links with status summary
|
|
2441
|
+
*/
|
|
2442
|
+
async listDropshipOrders(params) {
|
|
2443
|
+
let query = "";
|
|
2444
|
+
if (params) {
|
|
2445
|
+
const queryParams = {};
|
|
2446
|
+
if (params.status) {
|
|
2447
|
+
queryParams.status = Array.isArray(params.status) ? params.status.join(",") : params.status;
|
|
2448
|
+
}
|
|
2449
|
+
if (params.limit) queryParams.limit = params.limit.toString();
|
|
2450
|
+
if (params.offset) queryParams.offset = params.offset.toString();
|
|
2451
|
+
query = `?${buildQueryString(queryParams)}`;
|
|
2452
|
+
}
|
|
2453
|
+
return this.get(`/api/marketplace/merchant/dropship/orders${query}`);
|
|
2454
|
+
}
|
|
2455
|
+
/**
|
|
2456
|
+
* Forward orders to supplier
|
|
2457
|
+
*
|
|
2458
|
+
* @param orderItemIds - Order item IDs to forward
|
|
2459
|
+
* @returns Forward results
|
|
2460
|
+
*/
|
|
2461
|
+
async forwardDropshipOrders(orderItemIds) {
|
|
2462
|
+
return this.post("/api/marketplace/merchant/dropship/orders", {
|
|
2463
|
+
action: "forward",
|
|
2464
|
+
orderItemIds
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* Sync tracking for all pending dropship orders
|
|
2469
|
+
*
|
|
2470
|
+
* @returns Sync results
|
|
2471
|
+
*/
|
|
2472
|
+
async syncDropshipTracking() {
|
|
2473
|
+
return this.post("/api/marketplace/merchant/dropship/orders", {
|
|
2474
|
+
action: "sync"
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
/**
|
|
2478
|
+
* Get order forwarding details for manual forwarding
|
|
2479
|
+
*
|
|
2480
|
+
* @param orderItemId - Order item ID
|
|
2481
|
+
* @returns Forwarding details
|
|
2482
|
+
*/
|
|
2483
|
+
async getDropshipOrderDetails(orderItemId) {
|
|
2484
|
+
return this.get(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`);
|
|
2485
|
+
}
|
|
2486
|
+
/**
|
|
2487
|
+
* Forward a single order item to supplier
|
|
2488
|
+
*
|
|
2489
|
+
* @param orderItemId - Order item ID
|
|
2490
|
+
* @returns Forward result
|
|
2491
|
+
*/
|
|
2492
|
+
async forwardDropshipOrder(orderItemId) {
|
|
2493
|
+
return this.post(`/api/marketplace/merchant/dropship/orders/${orderItemId}/forward`, {});
|
|
2494
|
+
}
|
|
2495
|
+
/**
|
|
2496
|
+
* Get dropship settings
|
|
2497
|
+
*
|
|
2498
|
+
* @returns Merchant dropship settings
|
|
2499
|
+
*/
|
|
2500
|
+
async getDropshipSettings() {
|
|
2501
|
+
return this.get("/api/marketplace/merchant/dropship/settings");
|
|
2502
|
+
}
|
|
2503
|
+
/**
|
|
2504
|
+
* Update dropship settings
|
|
2505
|
+
*
|
|
2506
|
+
* @param request - Settings to update
|
|
2507
|
+
* @returns Updated settings
|
|
2508
|
+
*/
|
|
2509
|
+
async updateDropshipSettings(request) {
|
|
2510
|
+
return this.put("/api/marketplace/merchant/dropship/settings", request);
|
|
2511
|
+
}
|
|
2512
|
+
/**
|
|
2513
|
+
* Sync dropship products and/or orders
|
|
2514
|
+
*
|
|
2515
|
+
* @param type - Sync type (products, orders, all, single)
|
|
2516
|
+
* @param dropshipProductId - For single product sync
|
|
2517
|
+
* @returns Sync results
|
|
2518
|
+
*/
|
|
2519
|
+
async syncDropship(type, dropshipProductId) {
|
|
2520
|
+
return this.post("/api/marketplace/merchant/dropship/sync", {
|
|
2521
|
+
type,
|
|
2522
|
+
dropshipProductId
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
1955
2525
|
};
|
|
1956
2526
|
|
|
1957
2527
|
// lib/ecommerce/types/enums.ts
|
|
@@ -1969,6 +2539,8 @@ var OrderStatus = /* @__PURE__ */ ((OrderStatus2) => {
|
|
|
1969
2539
|
})(OrderStatus || {});
|
|
1970
2540
|
var PaymentMethod = /* @__PURE__ */ ((PaymentMethod2) => {
|
|
1971
2541
|
PaymentMethod2["USDC_ESCROW"] = "USDC_ESCROW";
|
|
2542
|
+
PaymentMethod2["BASEDPAY"] = "BASEDPAY";
|
|
2543
|
+
PaymentMethod2["STRIPE"] = "STRIPE";
|
|
1972
2544
|
PaymentMethod2["POINTS"] = "POINTS";
|
|
1973
2545
|
return PaymentMethod2;
|
|
1974
2546
|
})(PaymentMethod || {});
|