@basedone/core 0.2.1 → 0.2.2
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-Z5OW2FDP.mjs} +114 -0
- package/dist/ecommerce.d.mts +207 -1
- package/dist/ecommerce.d.ts +207 -1
- package/dist/ecommerce.js +114 -0
- package/dist/ecommerce.mjs +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +114 -0
- package/dist/index.mjs +1 -1
- package/lib/ecommerce/QUICK_REFERENCE.md +26 -0
- package/lib/ecommerce/README.md +26 -0
- package/lib/ecommerce/client/customer.ts +132 -0
- package/lib/ecommerce/types/requests.ts +24 -0
- package/lib/ecommerce/types/responses.ts +96 -0
- package/package.json +1 -1
|
@@ -821,6 +821,120 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
821
821
|
const queryString = params ? buildQueryString(params) : "";
|
|
822
822
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
823
823
|
}
|
|
824
|
+
// ============================================================================
|
|
825
|
+
// Merchant Storefront API
|
|
826
|
+
// ============================================================================
|
|
827
|
+
/**
|
|
828
|
+
* Get public merchant profile
|
|
829
|
+
*
|
|
830
|
+
* Fetches public information about a merchant for the storefront page.
|
|
831
|
+
*
|
|
832
|
+
* @param merchantId - Merchant ID
|
|
833
|
+
* @returns Public merchant profile with stats
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
838
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
async getMerchantProfile(merchantId) {
|
|
842
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
843
|
+
}
|
|
844
|
+
/**
|
|
845
|
+
* List merchant products
|
|
846
|
+
*
|
|
847
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
848
|
+
*
|
|
849
|
+
* @param merchantId - Merchant ID
|
|
850
|
+
* @param params - Query parameters for filtering and pagination
|
|
851
|
+
* @returns Paginated list of products
|
|
852
|
+
*
|
|
853
|
+
* @example
|
|
854
|
+
* ```typescript
|
|
855
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
856
|
+
* search: "laptop",
|
|
857
|
+
* sortBy: "popular",
|
|
858
|
+
* limit: 20,
|
|
859
|
+
* });
|
|
860
|
+
*
|
|
861
|
+
* result.items.forEach(product => {
|
|
862
|
+
* console.log(product.title, product.priceUSDC);
|
|
863
|
+
* });
|
|
864
|
+
* ```
|
|
865
|
+
*/
|
|
866
|
+
async getMerchantProducts(merchantId, params) {
|
|
867
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
868
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
869
|
+
}
|
|
870
|
+
// ============================================================================
|
|
871
|
+
// Shop Following API
|
|
872
|
+
// ============================================================================
|
|
873
|
+
/**
|
|
874
|
+
* Check if following a merchant
|
|
875
|
+
*
|
|
876
|
+
* @param merchantId - Merchant ID
|
|
877
|
+
* @returns Follow status with follow date if applicable
|
|
878
|
+
*
|
|
879
|
+
* @example
|
|
880
|
+
* ```typescript
|
|
881
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
882
|
+
* if (status.isFollowing) {
|
|
883
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
884
|
+
* }
|
|
885
|
+
* ```
|
|
886
|
+
*/
|
|
887
|
+
async isFollowingMerchant(merchantId) {
|
|
888
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
889
|
+
}
|
|
890
|
+
/**
|
|
891
|
+
* Follow a merchant
|
|
892
|
+
*
|
|
893
|
+
* @param merchantId - Merchant ID to follow
|
|
894
|
+
* @returns Follow action result
|
|
895
|
+
*
|
|
896
|
+
* @example
|
|
897
|
+
* ```typescript
|
|
898
|
+
* const result = await client.followMerchant("merchant_123");
|
|
899
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
900
|
+
* ```
|
|
901
|
+
*/
|
|
902
|
+
async followMerchant(merchantId) {
|
|
903
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
904
|
+
}
|
|
905
|
+
/**
|
|
906
|
+
* Unfollow a merchant
|
|
907
|
+
*
|
|
908
|
+
* @param merchantId - Merchant ID to unfollow
|
|
909
|
+
* @returns Unfollow action result
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* ```typescript
|
|
913
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
914
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
915
|
+
* ```
|
|
916
|
+
*/
|
|
917
|
+
async unfollowMerchant(merchantId) {
|
|
918
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
919
|
+
}
|
|
920
|
+
/**
|
|
921
|
+
* Get list of followed merchants
|
|
922
|
+
*
|
|
923
|
+
* @param params - Query parameters for pagination and sorting
|
|
924
|
+
* @returns Paginated list of followed merchants with their info
|
|
925
|
+
*
|
|
926
|
+
* @example
|
|
927
|
+
* ```typescript
|
|
928
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
929
|
+
* result.items.forEach(item => {
|
|
930
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
931
|
+
* });
|
|
932
|
+
* ```
|
|
933
|
+
*/
|
|
934
|
+
async getFollowedMerchants(params) {
|
|
935
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
936
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
937
|
+
}
|
|
824
938
|
};
|
|
825
939
|
|
|
826
940
|
// lib/ecommerce/client/merchant.ts
|
package/dist/ecommerce.d.mts
CHANGED
|
@@ -1689,6 +1689,28 @@ interface CreateFlashSaleRequest {
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {
|
|
1691
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* List merchant products params
|
|
1694
|
+
*/
|
|
1695
|
+
interface ListMerchantProductsParams extends PaginationParams {
|
|
1696
|
+
/** Search query */
|
|
1697
|
+
search?: string;
|
|
1698
|
+
/** Filter by category slug */
|
|
1699
|
+
category?: string;
|
|
1700
|
+
/** Minimum price */
|
|
1701
|
+
minPrice?: number;
|
|
1702
|
+
/** Maximum price */
|
|
1703
|
+
maxPrice?: number;
|
|
1704
|
+
/** Sort by: popular, latest, top_sales, price_asc, price_desc, rating */
|
|
1705
|
+
sortBy?: "popular" | "latest" | "top_sales" | "price_asc" | "price_desc" | "rating";
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* List followed merchants params
|
|
1709
|
+
*/
|
|
1710
|
+
interface ListFollowingParams extends PaginationParams {
|
|
1711
|
+
/** Sort by: recent (default) or name */
|
|
1712
|
+
sortBy?: "recent" | "name";
|
|
1713
|
+
}
|
|
1692
1714
|
|
|
1693
1715
|
/**
|
|
1694
1716
|
* Ecommerce API Response Types
|
|
@@ -1987,6 +2009,96 @@ interface MerchantProfileResponse {
|
|
|
1987
2009
|
/** Merchant */
|
|
1988
2010
|
merchant: Merchant;
|
|
1989
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Public merchant profile (for storefront)
|
|
2014
|
+
*/
|
|
2015
|
+
interface PublicMerchantProfile {
|
|
2016
|
+
/** Merchant ID */
|
|
2017
|
+
id: string;
|
|
2018
|
+
/** Merchant name */
|
|
2019
|
+
name: string;
|
|
2020
|
+
/** Description */
|
|
2021
|
+
description: string | null;
|
|
2022
|
+
/** Created at */
|
|
2023
|
+
createdAt: string;
|
|
2024
|
+
/** Number of active products */
|
|
2025
|
+
productCount: number;
|
|
2026
|
+
/** Total orders */
|
|
2027
|
+
orderCount: number;
|
|
2028
|
+
/** Average rating */
|
|
2029
|
+
averageRating: number | null;
|
|
2030
|
+
/** Total sold count */
|
|
2031
|
+
totalSold: number;
|
|
2032
|
+
/** Total view count */
|
|
2033
|
+
totalViews: number;
|
|
2034
|
+
/** Review count */
|
|
2035
|
+
reviewCount: number;
|
|
2036
|
+
/** Follower count */
|
|
2037
|
+
followerCount: number;
|
|
2038
|
+
/** Categories the merchant sells in */
|
|
2039
|
+
categories: string[];
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Public merchant profile response
|
|
2043
|
+
*/
|
|
2044
|
+
interface PublicMerchantProfileResponse {
|
|
2045
|
+
/** Merchant */
|
|
2046
|
+
merchant: PublicMerchantProfile;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Merchant products response
|
|
2050
|
+
*/
|
|
2051
|
+
interface MerchantProductsResponse extends PaginatedResponse<Product> {
|
|
2052
|
+
/** Merchant info */
|
|
2053
|
+
merchant: {
|
|
2054
|
+
id: string;
|
|
2055
|
+
name: string;
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Follow status response
|
|
2060
|
+
*/
|
|
2061
|
+
interface FollowStatusResponse {
|
|
2062
|
+
/** Whether the user is following */
|
|
2063
|
+
isFollowing: boolean;
|
|
2064
|
+
/** When the user followed (null if not following) */
|
|
2065
|
+
followedAt: string | null;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Follow action response
|
|
2069
|
+
*/
|
|
2070
|
+
interface FollowActionResponse {
|
|
2071
|
+
/** Success flag */
|
|
2072
|
+
success: boolean;
|
|
2073
|
+
/** Human-readable message */
|
|
2074
|
+
message: string;
|
|
2075
|
+
/** Whether the user is now following */
|
|
2076
|
+
isFollowing: boolean;
|
|
2077
|
+
/** When the user followed (only for follow action) */
|
|
2078
|
+
followedAt?: string;
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Followed merchant summary
|
|
2082
|
+
*/
|
|
2083
|
+
interface FollowedMerchantSummary {
|
|
2084
|
+
/** When the user followed */
|
|
2085
|
+
followedAt: string;
|
|
2086
|
+
/** Merchant info */
|
|
2087
|
+
merchant: {
|
|
2088
|
+
id: string;
|
|
2089
|
+
name: string;
|
|
2090
|
+
description: string | null;
|
|
2091
|
+
createdAt: string;
|
|
2092
|
+
productCount: number;
|
|
2093
|
+
averageRating: number | null;
|
|
2094
|
+
totalSold: number;
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
/**
|
|
2098
|
+
* List followed merchants response
|
|
2099
|
+
*/
|
|
2100
|
+
interface ListFollowingResponse extends PaginatedResponse<FollowedMerchantSummary> {
|
|
2101
|
+
}
|
|
1990
2102
|
/**
|
|
1991
2103
|
* List coupons response
|
|
1992
2104
|
*/
|
|
@@ -2929,6 +3041,100 @@ declare class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
2929
3041
|
* ```
|
|
2930
3042
|
*/
|
|
2931
3043
|
getActiveFlashSales(params?: ListActiveFlashSalesParams): Promise<ActiveFlashSalesResponse>;
|
|
3044
|
+
/**
|
|
3045
|
+
* Get public merchant profile
|
|
3046
|
+
*
|
|
3047
|
+
* Fetches public information about a merchant for the storefront page.
|
|
3048
|
+
*
|
|
3049
|
+
* @param merchantId - Merchant ID
|
|
3050
|
+
* @returns Public merchant profile with stats
|
|
3051
|
+
*
|
|
3052
|
+
* @example
|
|
3053
|
+
* ```typescript
|
|
3054
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
3055
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
3056
|
+
* ```
|
|
3057
|
+
*/
|
|
3058
|
+
getMerchantProfile(merchantId: string): Promise<PublicMerchantProfileResponse>;
|
|
3059
|
+
/**
|
|
3060
|
+
* List merchant products
|
|
3061
|
+
*
|
|
3062
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
3063
|
+
*
|
|
3064
|
+
* @param merchantId - Merchant ID
|
|
3065
|
+
* @param params - Query parameters for filtering and pagination
|
|
3066
|
+
* @returns Paginated list of products
|
|
3067
|
+
*
|
|
3068
|
+
* @example
|
|
3069
|
+
* ```typescript
|
|
3070
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
3071
|
+
* search: "laptop",
|
|
3072
|
+
* sortBy: "popular",
|
|
3073
|
+
* limit: 20,
|
|
3074
|
+
* });
|
|
3075
|
+
*
|
|
3076
|
+
* result.items.forEach(product => {
|
|
3077
|
+
* console.log(product.title, product.priceUSDC);
|
|
3078
|
+
* });
|
|
3079
|
+
* ```
|
|
3080
|
+
*/
|
|
3081
|
+
getMerchantProducts(merchantId: string, params?: ListMerchantProductsParams): Promise<MerchantProductsResponse>;
|
|
3082
|
+
/**
|
|
3083
|
+
* Check if following a merchant
|
|
3084
|
+
*
|
|
3085
|
+
* @param merchantId - Merchant ID
|
|
3086
|
+
* @returns Follow status with follow date if applicable
|
|
3087
|
+
*
|
|
3088
|
+
* @example
|
|
3089
|
+
* ```typescript
|
|
3090
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
3091
|
+
* if (status.isFollowing) {
|
|
3092
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
3093
|
+
* }
|
|
3094
|
+
* ```
|
|
3095
|
+
*/
|
|
3096
|
+
isFollowingMerchant(merchantId: string): Promise<FollowStatusResponse>;
|
|
3097
|
+
/**
|
|
3098
|
+
* Follow a merchant
|
|
3099
|
+
*
|
|
3100
|
+
* @param merchantId - Merchant ID to follow
|
|
3101
|
+
* @returns Follow action result
|
|
3102
|
+
*
|
|
3103
|
+
* @example
|
|
3104
|
+
* ```typescript
|
|
3105
|
+
* const result = await client.followMerchant("merchant_123");
|
|
3106
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
3107
|
+
* ```
|
|
3108
|
+
*/
|
|
3109
|
+
followMerchant(merchantId: string): Promise<FollowActionResponse>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Unfollow a merchant
|
|
3112
|
+
*
|
|
3113
|
+
* @param merchantId - Merchant ID to unfollow
|
|
3114
|
+
* @returns Unfollow action result
|
|
3115
|
+
*
|
|
3116
|
+
* @example
|
|
3117
|
+
* ```typescript
|
|
3118
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
3119
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
3120
|
+
* ```
|
|
3121
|
+
*/
|
|
3122
|
+
unfollowMerchant(merchantId: string): Promise<FollowActionResponse>;
|
|
3123
|
+
/**
|
|
3124
|
+
* Get list of followed merchants
|
|
3125
|
+
*
|
|
3126
|
+
* @param params - Query parameters for pagination and sorting
|
|
3127
|
+
* @returns Paginated list of followed merchants with their info
|
|
3128
|
+
*
|
|
3129
|
+
* @example
|
|
3130
|
+
* ```typescript
|
|
3131
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
3132
|
+
* result.items.forEach(item => {
|
|
3133
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
3134
|
+
* });
|
|
3135
|
+
* ```
|
|
3136
|
+
*/
|
|
3137
|
+
getFollowedMerchants(params?: ListFollowingParams): Promise<ListFollowingResponse>;
|
|
2932
3138
|
}
|
|
2933
3139
|
|
|
2934
3140
|
/**
|
|
@@ -3983,4 +4189,4 @@ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAG
|
|
|
3983
4189
|
*/
|
|
3984
4190
|
declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
|
|
3985
4191
|
|
|
3986
|
-
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProfileRequest, type MerchantProfileResponse, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, PaymentStatus, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|
|
4192
|
+
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type FollowActionResponse, type FollowStatusResponse, type FollowedMerchantSummary, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListFollowingParams, type ListFollowingResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMerchantProductsParams, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProductsResponse, type MerchantProfileRequest, type MerchantProfileResponse, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, PaymentStatus, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type PublicMerchantProfile, type PublicMerchantProfileResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|
package/dist/ecommerce.d.ts
CHANGED
|
@@ -1689,6 +1689,28 @@ interface CreateFlashSaleRequest {
|
|
|
1689
1689
|
*/
|
|
1690
1690
|
interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {
|
|
1691
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* List merchant products params
|
|
1694
|
+
*/
|
|
1695
|
+
interface ListMerchantProductsParams extends PaginationParams {
|
|
1696
|
+
/** Search query */
|
|
1697
|
+
search?: string;
|
|
1698
|
+
/** Filter by category slug */
|
|
1699
|
+
category?: string;
|
|
1700
|
+
/** Minimum price */
|
|
1701
|
+
minPrice?: number;
|
|
1702
|
+
/** Maximum price */
|
|
1703
|
+
maxPrice?: number;
|
|
1704
|
+
/** Sort by: popular, latest, top_sales, price_asc, price_desc, rating */
|
|
1705
|
+
sortBy?: "popular" | "latest" | "top_sales" | "price_asc" | "price_desc" | "rating";
|
|
1706
|
+
}
|
|
1707
|
+
/**
|
|
1708
|
+
* List followed merchants params
|
|
1709
|
+
*/
|
|
1710
|
+
interface ListFollowingParams extends PaginationParams {
|
|
1711
|
+
/** Sort by: recent (default) or name */
|
|
1712
|
+
sortBy?: "recent" | "name";
|
|
1713
|
+
}
|
|
1692
1714
|
|
|
1693
1715
|
/**
|
|
1694
1716
|
* Ecommerce API Response Types
|
|
@@ -1987,6 +2009,96 @@ interface MerchantProfileResponse {
|
|
|
1987
2009
|
/** Merchant */
|
|
1988
2010
|
merchant: Merchant;
|
|
1989
2011
|
}
|
|
2012
|
+
/**
|
|
2013
|
+
* Public merchant profile (for storefront)
|
|
2014
|
+
*/
|
|
2015
|
+
interface PublicMerchantProfile {
|
|
2016
|
+
/** Merchant ID */
|
|
2017
|
+
id: string;
|
|
2018
|
+
/** Merchant name */
|
|
2019
|
+
name: string;
|
|
2020
|
+
/** Description */
|
|
2021
|
+
description: string | null;
|
|
2022
|
+
/** Created at */
|
|
2023
|
+
createdAt: string;
|
|
2024
|
+
/** Number of active products */
|
|
2025
|
+
productCount: number;
|
|
2026
|
+
/** Total orders */
|
|
2027
|
+
orderCount: number;
|
|
2028
|
+
/** Average rating */
|
|
2029
|
+
averageRating: number | null;
|
|
2030
|
+
/** Total sold count */
|
|
2031
|
+
totalSold: number;
|
|
2032
|
+
/** Total view count */
|
|
2033
|
+
totalViews: number;
|
|
2034
|
+
/** Review count */
|
|
2035
|
+
reviewCount: number;
|
|
2036
|
+
/** Follower count */
|
|
2037
|
+
followerCount: number;
|
|
2038
|
+
/** Categories the merchant sells in */
|
|
2039
|
+
categories: string[];
|
|
2040
|
+
}
|
|
2041
|
+
/**
|
|
2042
|
+
* Public merchant profile response
|
|
2043
|
+
*/
|
|
2044
|
+
interface PublicMerchantProfileResponse {
|
|
2045
|
+
/** Merchant */
|
|
2046
|
+
merchant: PublicMerchantProfile;
|
|
2047
|
+
}
|
|
2048
|
+
/**
|
|
2049
|
+
* Merchant products response
|
|
2050
|
+
*/
|
|
2051
|
+
interface MerchantProductsResponse extends PaginatedResponse<Product> {
|
|
2052
|
+
/** Merchant info */
|
|
2053
|
+
merchant: {
|
|
2054
|
+
id: string;
|
|
2055
|
+
name: string;
|
|
2056
|
+
};
|
|
2057
|
+
}
|
|
2058
|
+
/**
|
|
2059
|
+
* Follow status response
|
|
2060
|
+
*/
|
|
2061
|
+
interface FollowStatusResponse {
|
|
2062
|
+
/** Whether the user is following */
|
|
2063
|
+
isFollowing: boolean;
|
|
2064
|
+
/** When the user followed (null if not following) */
|
|
2065
|
+
followedAt: string | null;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Follow action response
|
|
2069
|
+
*/
|
|
2070
|
+
interface FollowActionResponse {
|
|
2071
|
+
/** Success flag */
|
|
2072
|
+
success: boolean;
|
|
2073
|
+
/** Human-readable message */
|
|
2074
|
+
message: string;
|
|
2075
|
+
/** Whether the user is now following */
|
|
2076
|
+
isFollowing: boolean;
|
|
2077
|
+
/** When the user followed (only for follow action) */
|
|
2078
|
+
followedAt?: string;
|
|
2079
|
+
}
|
|
2080
|
+
/**
|
|
2081
|
+
* Followed merchant summary
|
|
2082
|
+
*/
|
|
2083
|
+
interface FollowedMerchantSummary {
|
|
2084
|
+
/** When the user followed */
|
|
2085
|
+
followedAt: string;
|
|
2086
|
+
/** Merchant info */
|
|
2087
|
+
merchant: {
|
|
2088
|
+
id: string;
|
|
2089
|
+
name: string;
|
|
2090
|
+
description: string | null;
|
|
2091
|
+
createdAt: string;
|
|
2092
|
+
productCount: number;
|
|
2093
|
+
averageRating: number | null;
|
|
2094
|
+
totalSold: number;
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
/**
|
|
2098
|
+
* List followed merchants response
|
|
2099
|
+
*/
|
|
2100
|
+
interface ListFollowingResponse extends PaginatedResponse<FollowedMerchantSummary> {
|
|
2101
|
+
}
|
|
1990
2102
|
/**
|
|
1991
2103
|
* List coupons response
|
|
1992
2104
|
*/
|
|
@@ -2929,6 +3041,100 @@ declare class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
2929
3041
|
* ```
|
|
2930
3042
|
*/
|
|
2931
3043
|
getActiveFlashSales(params?: ListActiveFlashSalesParams): Promise<ActiveFlashSalesResponse>;
|
|
3044
|
+
/**
|
|
3045
|
+
* Get public merchant profile
|
|
3046
|
+
*
|
|
3047
|
+
* Fetches public information about a merchant for the storefront page.
|
|
3048
|
+
*
|
|
3049
|
+
* @param merchantId - Merchant ID
|
|
3050
|
+
* @returns Public merchant profile with stats
|
|
3051
|
+
*
|
|
3052
|
+
* @example
|
|
3053
|
+
* ```typescript
|
|
3054
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
3055
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
3056
|
+
* ```
|
|
3057
|
+
*/
|
|
3058
|
+
getMerchantProfile(merchantId: string): Promise<PublicMerchantProfileResponse>;
|
|
3059
|
+
/**
|
|
3060
|
+
* List merchant products
|
|
3061
|
+
*
|
|
3062
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
3063
|
+
*
|
|
3064
|
+
* @param merchantId - Merchant ID
|
|
3065
|
+
* @param params - Query parameters for filtering and pagination
|
|
3066
|
+
* @returns Paginated list of products
|
|
3067
|
+
*
|
|
3068
|
+
* @example
|
|
3069
|
+
* ```typescript
|
|
3070
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
3071
|
+
* search: "laptop",
|
|
3072
|
+
* sortBy: "popular",
|
|
3073
|
+
* limit: 20,
|
|
3074
|
+
* });
|
|
3075
|
+
*
|
|
3076
|
+
* result.items.forEach(product => {
|
|
3077
|
+
* console.log(product.title, product.priceUSDC);
|
|
3078
|
+
* });
|
|
3079
|
+
* ```
|
|
3080
|
+
*/
|
|
3081
|
+
getMerchantProducts(merchantId: string, params?: ListMerchantProductsParams): Promise<MerchantProductsResponse>;
|
|
3082
|
+
/**
|
|
3083
|
+
* Check if following a merchant
|
|
3084
|
+
*
|
|
3085
|
+
* @param merchantId - Merchant ID
|
|
3086
|
+
* @returns Follow status with follow date if applicable
|
|
3087
|
+
*
|
|
3088
|
+
* @example
|
|
3089
|
+
* ```typescript
|
|
3090
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
3091
|
+
* if (status.isFollowing) {
|
|
3092
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
3093
|
+
* }
|
|
3094
|
+
* ```
|
|
3095
|
+
*/
|
|
3096
|
+
isFollowingMerchant(merchantId: string): Promise<FollowStatusResponse>;
|
|
3097
|
+
/**
|
|
3098
|
+
* Follow a merchant
|
|
3099
|
+
*
|
|
3100
|
+
* @param merchantId - Merchant ID to follow
|
|
3101
|
+
* @returns Follow action result
|
|
3102
|
+
*
|
|
3103
|
+
* @example
|
|
3104
|
+
* ```typescript
|
|
3105
|
+
* const result = await client.followMerchant("merchant_123");
|
|
3106
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
3107
|
+
* ```
|
|
3108
|
+
*/
|
|
3109
|
+
followMerchant(merchantId: string): Promise<FollowActionResponse>;
|
|
3110
|
+
/**
|
|
3111
|
+
* Unfollow a merchant
|
|
3112
|
+
*
|
|
3113
|
+
* @param merchantId - Merchant ID to unfollow
|
|
3114
|
+
* @returns Unfollow action result
|
|
3115
|
+
*
|
|
3116
|
+
* @example
|
|
3117
|
+
* ```typescript
|
|
3118
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
3119
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
3120
|
+
* ```
|
|
3121
|
+
*/
|
|
3122
|
+
unfollowMerchant(merchantId: string): Promise<FollowActionResponse>;
|
|
3123
|
+
/**
|
|
3124
|
+
* Get list of followed merchants
|
|
3125
|
+
*
|
|
3126
|
+
* @param params - Query parameters for pagination and sorting
|
|
3127
|
+
* @returns Paginated list of followed merchants with their info
|
|
3128
|
+
*
|
|
3129
|
+
* @example
|
|
3130
|
+
* ```typescript
|
|
3131
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
3132
|
+
* result.items.forEach(item => {
|
|
3133
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
3134
|
+
* });
|
|
3135
|
+
* ```
|
|
3136
|
+
*/
|
|
3137
|
+
getFollowedMerchants(params?: ListFollowingParams): Promise<ListFollowingResponse>;
|
|
2932
3138
|
}
|
|
2933
3139
|
|
|
2934
3140
|
/**
|
|
@@ -3983,4 +4189,4 @@ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAG
|
|
|
3983
4189
|
*/
|
|
3984
4190
|
declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
|
|
3985
4191
|
|
|
3986
|
-
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProfileRequest, type MerchantProfileResponse, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, PaymentStatus, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|
|
4192
|
+
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type FollowActionResponse, type FollowStatusResponse, type FollowedMerchantSummary, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListFollowingParams, type ListFollowingResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMerchantProductsParams, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProductsResponse, type MerchantProfileRequest, type MerchantProfileResponse, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, PaymentStatus, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type PublicMerchantProfile, type PublicMerchantProfileResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|
package/dist/ecommerce.js
CHANGED
|
@@ -831,6 +831,120 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
831
831
|
const queryString = params ? buildQueryString(params) : "";
|
|
832
832
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
833
833
|
}
|
|
834
|
+
// ============================================================================
|
|
835
|
+
// Merchant Storefront API
|
|
836
|
+
// ============================================================================
|
|
837
|
+
/**
|
|
838
|
+
* Get public merchant profile
|
|
839
|
+
*
|
|
840
|
+
* Fetches public information about a merchant for the storefront page.
|
|
841
|
+
*
|
|
842
|
+
* @param merchantId - Merchant ID
|
|
843
|
+
* @returns Public merchant profile with stats
|
|
844
|
+
*
|
|
845
|
+
* @example
|
|
846
|
+
* ```typescript
|
|
847
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
848
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
849
|
+
* ```
|
|
850
|
+
*/
|
|
851
|
+
async getMerchantProfile(merchantId) {
|
|
852
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
853
|
+
}
|
|
854
|
+
/**
|
|
855
|
+
* List merchant products
|
|
856
|
+
*
|
|
857
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
858
|
+
*
|
|
859
|
+
* @param merchantId - Merchant ID
|
|
860
|
+
* @param params - Query parameters for filtering and pagination
|
|
861
|
+
* @returns Paginated list of products
|
|
862
|
+
*
|
|
863
|
+
* @example
|
|
864
|
+
* ```typescript
|
|
865
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
866
|
+
* search: "laptop",
|
|
867
|
+
* sortBy: "popular",
|
|
868
|
+
* limit: 20,
|
|
869
|
+
* });
|
|
870
|
+
*
|
|
871
|
+
* result.items.forEach(product => {
|
|
872
|
+
* console.log(product.title, product.priceUSDC);
|
|
873
|
+
* });
|
|
874
|
+
* ```
|
|
875
|
+
*/
|
|
876
|
+
async getMerchantProducts(merchantId, params) {
|
|
877
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
878
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
879
|
+
}
|
|
880
|
+
// ============================================================================
|
|
881
|
+
// Shop Following API
|
|
882
|
+
// ============================================================================
|
|
883
|
+
/**
|
|
884
|
+
* Check if following a merchant
|
|
885
|
+
*
|
|
886
|
+
* @param merchantId - Merchant ID
|
|
887
|
+
* @returns Follow status with follow date if applicable
|
|
888
|
+
*
|
|
889
|
+
* @example
|
|
890
|
+
* ```typescript
|
|
891
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
892
|
+
* if (status.isFollowing) {
|
|
893
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
894
|
+
* }
|
|
895
|
+
* ```
|
|
896
|
+
*/
|
|
897
|
+
async isFollowingMerchant(merchantId) {
|
|
898
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
899
|
+
}
|
|
900
|
+
/**
|
|
901
|
+
* Follow a merchant
|
|
902
|
+
*
|
|
903
|
+
* @param merchantId - Merchant ID to follow
|
|
904
|
+
* @returns Follow action result
|
|
905
|
+
*
|
|
906
|
+
* @example
|
|
907
|
+
* ```typescript
|
|
908
|
+
* const result = await client.followMerchant("merchant_123");
|
|
909
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
910
|
+
* ```
|
|
911
|
+
*/
|
|
912
|
+
async followMerchant(merchantId) {
|
|
913
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
914
|
+
}
|
|
915
|
+
/**
|
|
916
|
+
* Unfollow a merchant
|
|
917
|
+
*
|
|
918
|
+
* @param merchantId - Merchant ID to unfollow
|
|
919
|
+
* @returns Unfollow action result
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* ```typescript
|
|
923
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
924
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
925
|
+
* ```
|
|
926
|
+
*/
|
|
927
|
+
async unfollowMerchant(merchantId) {
|
|
928
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
929
|
+
}
|
|
930
|
+
/**
|
|
931
|
+
* Get list of followed merchants
|
|
932
|
+
*
|
|
933
|
+
* @param params - Query parameters for pagination and sorting
|
|
934
|
+
* @returns Paginated list of followed merchants with their info
|
|
935
|
+
*
|
|
936
|
+
* @example
|
|
937
|
+
* ```typescript
|
|
938
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
939
|
+
* result.items.forEach(item => {
|
|
940
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
941
|
+
* });
|
|
942
|
+
* ```
|
|
943
|
+
*/
|
|
944
|
+
async getFollowedMerchants(params) {
|
|
945
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
946
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
947
|
+
}
|
|
834
948
|
};
|
|
835
949
|
|
|
836
950
|
// lib/ecommerce/client/merchant.ts
|
package/dist/ecommerce.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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-
|
|
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';
|
|
2
2
|
import './chunk-4UEJOM6W.mjs';
|
package/dist/index.d.mts
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.mjs';
|
|
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.mjs';
|
|
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, FollowActionResponse, FollowStatusResponse, FollowedMerchantSummary, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, 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, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProductsResponse, 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, PublicMerchantProfile, PublicMerchantProfileResponse, 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.mjs';
|
|
5
5
|
import 'axios';
|
|
6
6
|
|
|
7
7
|
declare function encodeSlug(slug: string): bigint;
|
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, 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, FollowActionResponse, FollowStatusResponse, FollowedMerchantSummary, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, 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, ListTaxNexusResponse, ListTaxReportsParams, ListTaxReportsResponse, ListTaxRulesResponse, MediaAsset, MediaAssetResponse, Merchant, MerchantEcommerceClient, MerchantProductsResponse, 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, PublicMerchantProfile, PublicMerchantProfileResponse, 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';
|
|
5
5
|
import 'axios';
|
|
6
6
|
|
|
7
7
|
declare function encodeSlug(slug: string): bigint;
|
package/dist/index.js
CHANGED
|
@@ -43151,6 +43151,120 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
43151
43151
|
const queryString = params ? buildQueryString(params) : "";
|
|
43152
43152
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
43153
43153
|
}
|
|
43154
|
+
// ============================================================================
|
|
43155
|
+
// Merchant Storefront API
|
|
43156
|
+
// ============================================================================
|
|
43157
|
+
/**
|
|
43158
|
+
* Get public merchant profile
|
|
43159
|
+
*
|
|
43160
|
+
* Fetches public information about a merchant for the storefront page.
|
|
43161
|
+
*
|
|
43162
|
+
* @param merchantId - Merchant ID
|
|
43163
|
+
* @returns Public merchant profile with stats
|
|
43164
|
+
*
|
|
43165
|
+
* @example
|
|
43166
|
+
* ```typescript
|
|
43167
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
43168
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
43169
|
+
* ```
|
|
43170
|
+
*/
|
|
43171
|
+
async getMerchantProfile(merchantId) {
|
|
43172
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
43173
|
+
}
|
|
43174
|
+
/**
|
|
43175
|
+
* List merchant products
|
|
43176
|
+
*
|
|
43177
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
43178
|
+
*
|
|
43179
|
+
* @param merchantId - Merchant ID
|
|
43180
|
+
* @param params - Query parameters for filtering and pagination
|
|
43181
|
+
* @returns Paginated list of products
|
|
43182
|
+
*
|
|
43183
|
+
* @example
|
|
43184
|
+
* ```typescript
|
|
43185
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
43186
|
+
* search: "laptop",
|
|
43187
|
+
* sortBy: "popular",
|
|
43188
|
+
* limit: 20,
|
|
43189
|
+
* });
|
|
43190
|
+
*
|
|
43191
|
+
* result.items.forEach(product => {
|
|
43192
|
+
* console.log(product.title, product.priceUSDC);
|
|
43193
|
+
* });
|
|
43194
|
+
* ```
|
|
43195
|
+
*/
|
|
43196
|
+
async getMerchantProducts(merchantId, params) {
|
|
43197
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
43198
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
43199
|
+
}
|
|
43200
|
+
// ============================================================================
|
|
43201
|
+
// Shop Following API
|
|
43202
|
+
// ============================================================================
|
|
43203
|
+
/**
|
|
43204
|
+
* Check if following a merchant
|
|
43205
|
+
*
|
|
43206
|
+
* @param merchantId - Merchant ID
|
|
43207
|
+
* @returns Follow status with follow date if applicable
|
|
43208
|
+
*
|
|
43209
|
+
* @example
|
|
43210
|
+
* ```typescript
|
|
43211
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
43212
|
+
* if (status.isFollowing) {
|
|
43213
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
43214
|
+
* }
|
|
43215
|
+
* ```
|
|
43216
|
+
*/
|
|
43217
|
+
async isFollowingMerchant(merchantId) {
|
|
43218
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
43219
|
+
}
|
|
43220
|
+
/**
|
|
43221
|
+
* Follow a merchant
|
|
43222
|
+
*
|
|
43223
|
+
* @param merchantId - Merchant ID to follow
|
|
43224
|
+
* @returns Follow action result
|
|
43225
|
+
*
|
|
43226
|
+
* @example
|
|
43227
|
+
* ```typescript
|
|
43228
|
+
* const result = await client.followMerchant("merchant_123");
|
|
43229
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
43230
|
+
* ```
|
|
43231
|
+
*/
|
|
43232
|
+
async followMerchant(merchantId) {
|
|
43233
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
43234
|
+
}
|
|
43235
|
+
/**
|
|
43236
|
+
* Unfollow a merchant
|
|
43237
|
+
*
|
|
43238
|
+
* @param merchantId - Merchant ID to unfollow
|
|
43239
|
+
* @returns Unfollow action result
|
|
43240
|
+
*
|
|
43241
|
+
* @example
|
|
43242
|
+
* ```typescript
|
|
43243
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
43244
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
43245
|
+
* ```
|
|
43246
|
+
*/
|
|
43247
|
+
async unfollowMerchant(merchantId) {
|
|
43248
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
43249
|
+
}
|
|
43250
|
+
/**
|
|
43251
|
+
* Get list of followed merchants
|
|
43252
|
+
*
|
|
43253
|
+
* @param params - Query parameters for pagination and sorting
|
|
43254
|
+
* @returns Paginated list of followed merchants with their info
|
|
43255
|
+
*
|
|
43256
|
+
* @example
|
|
43257
|
+
* ```typescript
|
|
43258
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
43259
|
+
* result.items.forEach(item => {
|
|
43260
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
43261
|
+
* });
|
|
43262
|
+
* ```
|
|
43263
|
+
*/
|
|
43264
|
+
async getFollowedMerchants(params) {
|
|
43265
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
43266
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
43267
|
+
}
|
|
43154
43268
|
};
|
|
43155
43269
|
|
|
43156
43270
|
// lib/ecommerce/client/merchant.ts
|
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-
|
|
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';
|
|
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';
|
|
@@ -57,6 +57,16 @@ await client.createReview("prod_123", {
|
|
|
57
57
|
comment: "Love it!",
|
|
58
58
|
});
|
|
59
59
|
|
|
60
|
+
// Shop Following
|
|
61
|
+
const followStatus = await client.isFollowingMerchant("merchant_123");
|
|
62
|
+
await client.followMerchant("merchant_123");
|
|
63
|
+
await client.unfollowMerchant("merchant_123");
|
|
64
|
+
const following = await client.getFollowedMerchants({ limit: 20 });
|
|
65
|
+
|
|
66
|
+
// Merchant Profile & Products (public)
|
|
67
|
+
const merchant = await client.getMerchantProfile("merchant_123");
|
|
68
|
+
const products = await client.getMerchantProducts("merchant_123", { sortBy: "popular" });
|
|
69
|
+
|
|
60
70
|
// Calculate discounts
|
|
61
71
|
const discounts = await client.calculateCartDiscounts({
|
|
62
72
|
items: [{ productId: "prod_123", quantity: 2 }],
|
|
@@ -67,6 +77,17 @@ const tax = await client.calculateTax({
|
|
|
67
77
|
items: [{ productId: "prod_123", quantity: 2 }],
|
|
68
78
|
shippingAddress: { country: "US", region: "NY" },
|
|
69
79
|
});
|
|
80
|
+
|
|
81
|
+
// Get merchant storefront profile
|
|
82
|
+
const merchant = await client.getMerchantProfile("merchant_123");
|
|
83
|
+
console.log(merchant.merchant.name, merchant.merchant.productCount);
|
|
84
|
+
|
|
85
|
+
// List merchant products with search/sort
|
|
86
|
+
const merchantProducts = await client.getMerchantProducts("merchant_123", {
|
|
87
|
+
search: "laptop",
|
|
88
|
+
sortBy: "popular",
|
|
89
|
+
limit: 20,
|
|
90
|
+
});
|
|
70
91
|
```
|
|
71
92
|
|
|
72
93
|
## Merchant Client
|
|
@@ -200,6 +221,11 @@ import type {
|
|
|
200
221
|
PaymentMethod,
|
|
201
222
|
CreateOrderRequest,
|
|
202
223
|
ListProductsParams,
|
|
224
|
+
// Merchant storefront types
|
|
225
|
+
PublicMerchantProfile,
|
|
226
|
+
PublicMerchantProfileResponse,
|
|
227
|
+
MerchantProductsResponse,
|
|
228
|
+
ListMerchantProductsParams,
|
|
203
229
|
} from "@basedone/core/ecommerce";
|
|
204
230
|
```
|
|
205
231
|
|
package/lib/ecommerce/README.md
CHANGED
|
@@ -68,6 +68,17 @@ if (order.escrow) {
|
|
|
68
68
|
// After depositing, confirm the transaction
|
|
69
69
|
await client.confirmEscrowDeposit(order.orders[0].id);
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
// Browse a merchant's storefront
|
|
73
|
+
const merchantProfile = await client.getMerchantProfile("merchant_123");
|
|
74
|
+
console.log(`${merchantProfile.merchant.name} - ${merchantProfile.merchant.productCount} products`);
|
|
75
|
+
|
|
76
|
+
// Get merchant products with search and sort
|
|
77
|
+
const merchantProducts = await client.getMerchantProducts("merchant_123", {
|
|
78
|
+
search: "laptop",
|
|
79
|
+
sortBy: "popular", // popular, latest, top_sales, price_asc, price_desc, rating
|
|
80
|
+
limit: 20,
|
|
81
|
+
});
|
|
71
82
|
```
|
|
72
83
|
|
|
73
84
|
### Merchant Client
|
|
@@ -142,6 +153,16 @@ await client.updateOrderStatus("ord_123", {
|
|
|
142
153
|
- `getActiveBanners(params?)` - Get active promotional banners
|
|
143
154
|
- `trackBanner(bannerId, request)` - Track banner impression/click
|
|
144
155
|
|
|
156
|
+
#### Merchant Storefront (Public)
|
|
157
|
+
- `getMerchantProfile(merchantId)` - Get public merchant profile
|
|
158
|
+
- `getMerchantProducts(merchantId, params?)` - Get merchant's products with filtering
|
|
159
|
+
|
|
160
|
+
#### Shop Following
|
|
161
|
+
- `isFollowingMerchant(merchantId)` - Check if following a merchant
|
|
162
|
+
- `followMerchant(merchantId)` - Follow a merchant
|
|
163
|
+
- `unfollowMerchant(merchantId)` - Unfollow a merchant
|
|
164
|
+
- `getFollowedMerchants(params?)` - Get list of followed merchants
|
|
165
|
+
|
|
145
166
|
### Merchant APIs
|
|
146
167
|
|
|
147
168
|
#### Profile
|
|
@@ -319,6 +340,11 @@ import type {
|
|
|
319
340
|
PaymentMethod,
|
|
320
341
|
CreateOrderRequest,
|
|
321
342
|
ListProductsParams,
|
|
343
|
+
// Merchant storefront types
|
|
344
|
+
PublicMerchantProfile,
|
|
345
|
+
PublicMerchantProfileResponse,
|
|
346
|
+
MerchantProductsResponse,
|
|
347
|
+
ListMerchantProductsParams,
|
|
322
348
|
// ... and many more
|
|
323
349
|
} from "@basedone/core/ecommerce";
|
|
324
350
|
```
|
|
@@ -22,6 +22,8 @@ import type {
|
|
|
22
22
|
TrackBannerRequest,
|
|
23
23
|
SendMessageRequest,
|
|
24
24
|
ListActiveFlashSalesParams,
|
|
25
|
+
ListMerchantProductsParams,
|
|
26
|
+
ListFollowingParams,
|
|
25
27
|
|
|
26
28
|
// Response types
|
|
27
29
|
ListProductsResponse,
|
|
@@ -45,6 +47,11 @@ import type {
|
|
|
45
47
|
MessageStatsResponse,
|
|
46
48
|
MessageResponse,
|
|
47
49
|
ActiveFlashSalesResponse,
|
|
50
|
+
PublicMerchantProfileResponse,
|
|
51
|
+
MerchantProductsResponse,
|
|
52
|
+
FollowStatusResponse,
|
|
53
|
+
FollowActionResponse,
|
|
54
|
+
ListFollowingResponse,
|
|
48
55
|
} from "../types";
|
|
49
56
|
|
|
50
57
|
/**
|
|
@@ -635,5 +642,130 @@ export class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
635
642
|
const queryString = params ? buildQueryString(params) : "";
|
|
636
643
|
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
637
644
|
}
|
|
645
|
+
|
|
646
|
+
// ============================================================================
|
|
647
|
+
// Merchant Storefront API
|
|
648
|
+
// ============================================================================
|
|
649
|
+
|
|
650
|
+
/**
|
|
651
|
+
* Get public merchant profile
|
|
652
|
+
*
|
|
653
|
+
* Fetches public information about a merchant for the storefront page.
|
|
654
|
+
*
|
|
655
|
+
* @param merchantId - Merchant ID
|
|
656
|
+
* @returns Public merchant profile with stats
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* const result = await client.getMerchantProfile("merchant_123");
|
|
661
|
+
* console.log(result.merchant.name, result.merchant.productCount);
|
|
662
|
+
* ```
|
|
663
|
+
*/
|
|
664
|
+
async getMerchantProfile(merchantId: string): Promise<PublicMerchantProfileResponse> {
|
|
665
|
+
return this.get(`/api/marketplace/merchants/${merchantId}`);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* List merchant products
|
|
670
|
+
*
|
|
671
|
+
* Fetches products for a specific merchant with search, filter, and sort options.
|
|
672
|
+
*
|
|
673
|
+
* @param merchantId - Merchant ID
|
|
674
|
+
* @param params - Query parameters for filtering and pagination
|
|
675
|
+
* @returns Paginated list of products
|
|
676
|
+
*
|
|
677
|
+
* @example
|
|
678
|
+
* ```typescript
|
|
679
|
+
* const result = await client.getMerchantProducts("merchant_123", {
|
|
680
|
+
* search: "laptop",
|
|
681
|
+
* sortBy: "popular",
|
|
682
|
+
* limit: 20,
|
|
683
|
+
* });
|
|
684
|
+
*
|
|
685
|
+
* result.items.forEach(product => {
|
|
686
|
+
* console.log(product.title, product.priceUSDC);
|
|
687
|
+
* });
|
|
688
|
+
* ```
|
|
689
|
+
*/
|
|
690
|
+
async getMerchantProducts(
|
|
691
|
+
merchantId: string,
|
|
692
|
+
params?: ListMerchantProductsParams
|
|
693
|
+
): Promise<MerchantProductsResponse> {
|
|
694
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
695
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
|
|
696
|
+
}
|
|
697
|
+
|
|
698
|
+
// ============================================================================
|
|
699
|
+
// Shop Following API
|
|
700
|
+
// ============================================================================
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Check if following a merchant
|
|
704
|
+
*
|
|
705
|
+
* @param merchantId - Merchant ID
|
|
706
|
+
* @returns Follow status with follow date if applicable
|
|
707
|
+
*
|
|
708
|
+
* @example
|
|
709
|
+
* ```typescript
|
|
710
|
+
* const status = await client.isFollowingMerchant("merchant_123");
|
|
711
|
+
* if (status.isFollowing) {
|
|
712
|
+
* console.log(`Following since ${status.followedAt}`);
|
|
713
|
+
* }
|
|
714
|
+
* ```
|
|
715
|
+
*/
|
|
716
|
+
async isFollowingMerchant(merchantId: string): Promise<FollowStatusResponse> {
|
|
717
|
+
return this.get(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
/**
|
|
721
|
+
* Follow a merchant
|
|
722
|
+
*
|
|
723
|
+
* @param merchantId - Merchant ID to follow
|
|
724
|
+
* @returns Follow action result
|
|
725
|
+
*
|
|
726
|
+
* @example
|
|
727
|
+
* ```typescript
|
|
728
|
+
* const result = await client.followMerchant("merchant_123");
|
|
729
|
+
* console.log(result.message); // "Now following Awesome Store"
|
|
730
|
+
* ```
|
|
731
|
+
*/
|
|
732
|
+
async followMerchant(merchantId: string): Promise<FollowActionResponse> {
|
|
733
|
+
return this.post(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
/**
|
|
737
|
+
* Unfollow a merchant
|
|
738
|
+
*
|
|
739
|
+
* @param merchantId - Merchant ID to unfollow
|
|
740
|
+
* @returns Unfollow action result
|
|
741
|
+
*
|
|
742
|
+
* @example
|
|
743
|
+
* ```typescript
|
|
744
|
+
* const result = await client.unfollowMerchant("merchant_123");
|
|
745
|
+
* console.log(result.message); // "Unfollowed successfully"
|
|
746
|
+
* ```
|
|
747
|
+
*/
|
|
748
|
+
async unfollowMerchant(merchantId: string): Promise<FollowActionResponse> {
|
|
749
|
+
return this.delete(`/api/marketplace/merchants/${merchantId}/follow`);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Get list of followed merchants
|
|
754
|
+
*
|
|
755
|
+
* @param params - Query parameters for pagination and sorting
|
|
756
|
+
* @returns Paginated list of followed merchants with their info
|
|
757
|
+
*
|
|
758
|
+
* @example
|
|
759
|
+
* ```typescript
|
|
760
|
+
* const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
|
|
761
|
+
* result.items.forEach(item => {
|
|
762
|
+
* console.log(`${item.merchant.name} - followed on ${item.followedAt}`);
|
|
763
|
+
* });
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
async getFollowedMerchants(params?: ListFollowingParams): Promise<ListFollowingResponse> {
|
|
767
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
768
|
+
return this.get(`/api/marketplace/following${queryString}`);
|
|
769
|
+
}
|
|
638
770
|
}
|
|
639
771
|
|
|
@@ -578,3 +578,27 @@ export interface CreateFlashSaleRequest {
|
|
|
578
578
|
*/
|
|
579
579
|
export interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {}
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* List merchant products params
|
|
583
|
+
*/
|
|
584
|
+
export interface ListMerchantProductsParams extends PaginationParams {
|
|
585
|
+
/** Search query */
|
|
586
|
+
search?: string;
|
|
587
|
+
/** Filter by category slug */
|
|
588
|
+
category?: string;
|
|
589
|
+
/** Minimum price */
|
|
590
|
+
minPrice?: number;
|
|
591
|
+
/** Maximum price */
|
|
592
|
+
maxPrice?: number;
|
|
593
|
+
/** Sort by: popular, latest, top_sales, price_asc, price_desc, rating */
|
|
594
|
+
sortBy?: "popular" | "latest" | "top_sales" | "price_asc" | "price_desc" | "rating";
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* List followed merchants params
|
|
599
|
+
*/
|
|
600
|
+
export interface ListFollowingParams extends PaginationParams {
|
|
601
|
+
/** Sort by: recent (default) or name */
|
|
602
|
+
sortBy?: "recent" | "name";
|
|
603
|
+
}
|
|
604
|
+
|
|
@@ -340,6 +340,102 @@ export interface MerchantProfileResponse {
|
|
|
340
340
|
merchant: Merchant;
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
+
/**
|
|
344
|
+
* Public merchant profile (for storefront)
|
|
345
|
+
*/
|
|
346
|
+
export interface PublicMerchantProfile {
|
|
347
|
+
/** Merchant ID */
|
|
348
|
+
id: string;
|
|
349
|
+
/** Merchant name */
|
|
350
|
+
name: string;
|
|
351
|
+
/** Description */
|
|
352
|
+
description: string | null;
|
|
353
|
+
/** Created at */
|
|
354
|
+
createdAt: string;
|
|
355
|
+
/** Number of active products */
|
|
356
|
+
productCount: number;
|
|
357
|
+
/** Total orders */
|
|
358
|
+
orderCount: number;
|
|
359
|
+
/** Average rating */
|
|
360
|
+
averageRating: number | null;
|
|
361
|
+
/** Total sold count */
|
|
362
|
+
totalSold: number;
|
|
363
|
+
/** Total view count */
|
|
364
|
+
totalViews: number;
|
|
365
|
+
/** Review count */
|
|
366
|
+
reviewCount: number;
|
|
367
|
+
/** Follower count */
|
|
368
|
+
followerCount: number;
|
|
369
|
+
/** Categories the merchant sells in */
|
|
370
|
+
categories: string[];
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Public merchant profile response
|
|
375
|
+
*/
|
|
376
|
+
export interface PublicMerchantProfileResponse {
|
|
377
|
+
/** Merchant */
|
|
378
|
+
merchant: PublicMerchantProfile;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Merchant products response
|
|
383
|
+
*/
|
|
384
|
+
export interface MerchantProductsResponse extends PaginatedResponse<Product> {
|
|
385
|
+
/** Merchant info */
|
|
386
|
+
merchant: {
|
|
387
|
+
id: string;
|
|
388
|
+
name: string;
|
|
389
|
+
};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Follow status response
|
|
394
|
+
*/
|
|
395
|
+
export interface FollowStatusResponse {
|
|
396
|
+
/** Whether the user is following */
|
|
397
|
+
isFollowing: boolean;
|
|
398
|
+
/** When the user followed (null if not following) */
|
|
399
|
+
followedAt: string | null;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Follow action response
|
|
404
|
+
*/
|
|
405
|
+
export interface FollowActionResponse {
|
|
406
|
+
/** Success flag */
|
|
407
|
+
success: boolean;
|
|
408
|
+
/** Human-readable message */
|
|
409
|
+
message: string;
|
|
410
|
+
/** Whether the user is now following */
|
|
411
|
+
isFollowing: boolean;
|
|
412
|
+
/** When the user followed (only for follow action) */
|
|
413
|
+
followedAt?: string;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Followed merchant summary
|
|
418
|
+
*/
|
|
419
|
+
export interface FollowedMerchantSummary {
|
|
420
|
+
/** When the user followed */
|
|
421
|
+
followedAt: string;
|
|
422
|
+
/** Merchant info */
|
|
423
|
+
merchant: {
|
|
424
|
+
id: string;
|
|
425
|
+
name: string;
|
|
426
|
+
description: string | null;
|
|
427
|
+
createdAt: string;
|
|
428
|
+
productCount: number;
|
|
429
|
+
averageRating: number | null;
|
|
430
|
+
totalSold: number;
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* List followed merchants response
|
|
436
|
+
*/
|
|
437
|
+
export interface ListFollowingResponse extends PaginatedResponse<FollowedMerchantSummary> {}
|
|
438
|
+
|
|
343
439
|
/**
|
|
344
440
|
* List coupons response
|
|
345
441
|
*/
|