@basedone/core 0.2.0 → 0.2.1
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-4GAKANLT.mjs → chunk-MVFO4WRF.mjs} +104 -0
- package/dist/ecommerce.d.mts +255 -1
- package/dist/ecommerce.d.ts +255 -1
- package/dist/ecommerce.js +104 -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 +104 -0
- package/dist/index.mjs +1 -1
- package/lib/ecommerce/FLASH_SALES.md +340 -0
- package/lib/ecommerce/README.md +6 -0
- package/lib/ecommerce/client/customer.ts +117 -0
- package/lib/ecommerce/types/entities.ts +69 -0
- package/lib/ecommerce/types/requests.ts +55 -0
- package/lib/ecommerce/types/responses.ts +52 -0
- package/package.json +1 -1
package/dist/ecommerce.d.ts
CHANGED
|
@@ -1093,6 +1093,73 @@ interface CustomerSummary {
|
|
|
1093
1093
|
/** First order date */
|
|
1094
1094
|
firstOrderDate?: string;
|
|
1095
1095
|
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Flash sale item entity
|
|
1098
|
+
*/
|
|
1099
|
+
interface FlashSaleItem {
|
|
1100
|
+
/** Item ID */
|
|
1101
|
+
id: string;
|
|
1102
|
+
/** Product ID */
|
|
1103
|
+
productId: string;
|
|
1104
|
+
/** Sale price in USDC */
|
|
1105
|
+
salePrice: string;
|
|
1106
|
+
/** Original price in USDC */
|
|
1107
|
+
originalPrice: string;
|
|
1108
|
+
/** Discount percentage */
|
|
1109
|
+
discountPercent: number;
|
|
1110
|
+
/** Maximum quantity available at this price */
|
|
1111
|
+
maxQuantity: number | null;
|
|
1112
|
+
/** Quantity sold at flash price */
|
|
1113
|
+
soldQuantity: number;
|
|
1114
|
+
/** Remaining quantity */
|
|
1115
|
+
remainingQuantity: number | null;
|
|
1116
|
+
/** Limit per customer */
|
|
1117
|
+
limitPerCustomer: number | null;
|
|
1118
|
+
/** Product details */
|
|
1119
|
+
product: {
|
|
1120
|
+
id: string;
|
|
1121
|
+
title: string;
|
|
1122
|
+
description?: string | null;
|
|
1123
|
+
images: string[];
|
|
1124
|
+
priceUSDC: string;
|
|
1125
|
+
inventory: number | null;
|
|
1126
|
+
soldCount: number;
|
|
1127
|
+
averageRating: number | null;
|
|
1128
|
+
reviewCount: number;
|
|
1129
|
+
merchant?: {
|
|
1130
|
+
id: string;
|
|
1131
|
+
name: string;
|
|
1132
|
+
};
|
|
1133
|
+
};
|
|
1134
|
+
}
|
|
1135
|
+
/**
|
|
1136
|
+
* Flash sale entity
|
|
1137
|
+
*/
|
|
1138
|
+
interface FlashSale {
|
|
1139
|
+
/** Flash sale ID */
|
|
1140
|
+
id: string;
|
|
1141
|
+
/** Sale name */
|
|
1142
|
+
name: string;
|
|
1143
|
+
/** Description */
|
|
1144
|
+
description?: string | null;
|
|
1145
|
+
/** Start timestamp */
|
|
1146
|
+
startsAt: string;
|
|
1147
|
+
/** End timestamp */
|
|
1148
|
+
endsAt: string;
|
|
1149
|
+
/** Badge text (e.g., "Mall", "Hot Deal") */
|
|
1150
|
+
badgeText?: string | null;
|
|
1151
|
+
/** Badge color (hex) */
|
|
1152
|
+
badgeColor?: string | null;
|
|
1153
|
+
/** Priority (higher = shown first) */
|
|
1154
|
+
priority: number;
|
|
1155
|
+
/** Merchant information */
|
|
1156
|
+
merchant?: {
|
|
1157
|
+
id: string;
|
|
1158
|
+
name: string;
|
|
1159
|
+
} | null;
|
|
1160
|
+
/** Flash sale items */
|
|
1161
|
+
items: FlashSaleItem[];
|
|
1162
|
+
}
|
|
1096
1163
|
|
|
1097
1164
|
/**
|
|
1098
1165
|
* Ecommerce API Request Types
|
|
@@ -1570,6 +1637,58 @@ interface ListActiveBannersParams {
|
|
|
1570
1637
|
/** Filter by merchant ID */
|
|
1571
1638
|
merchantId?: string;
|
|
1572
1639
|
}
|
|
1640
|
+
/**
|
|
1641
|
+
* List active flash sales params
|
|
1642
|
+
*/
|
|
1643
|
+
interface ListActiveFlashSalesParams {
|
|
1644
|
+
/** Maximum number of flash sales to return */
|
|
1645
|
+
limit?: number;
|
|
1646
|
+
/** Filter by merchant ID */
|
|
1647
|
+
merchantId?: string;
|
|
1648
|
+
}
|
|
1649
|
+
/**
|
|
1650
|
+
* Flash sale item input
|
|
1651
|
+
*/
|
|
1652
|
+
interface FlashSaleItemInput {
|
|
1653
|
+
/** Product ID */
|
|
1654
|
+
productId: string;
|
|
1655
|
+
/** Sale price in USDC */
|
|
1656
|
+
salePrice: number;
|
|
1657
|
+
/** Maximum quantity available */
|
|
1658
|
+
maxQuantity?: number | null;
|
|
1659
|
+
/** Limit per customer */
|
|
1660
|
+
limitPerCustomer?: number;
|
|
1661
|
+
/** Sort order */
|
|
1662
|
+
sortOrder?: number;
|
|
1663
|
+
}
|
|
1664
|
+
/**
|
|
1665
|
+
* Create flash sale request
|
|
1666
|
+
*/
|
|
1667
|
+
interface CreateFlashSaleRequest {
|
|
1668
|
+
/** Sale name */
|
|
1669
|
+
name: string;
|
|
1670
|
+
/** Description */
|
|
1671
|
+
description?: string | null;
|
|
1672
|
+
/** Start timestamp */
|
|
1673
|
+
startsAt: string;
|
|
1674
|
+
/** End timestamp */
|
|
1675
|
+
endsAt: string;
|
|
1676
|
+
/** Badge text */
|
|
1677
|
+
badgeText?: string;
|
|
1678
|
+
/** Badge color (hex) */
|
|
1679
|
+
badgeColor?: string;
|
|
1680
|
+
/** Priority (higher = shown first) */
|
|
1681
|
+
priority?: number;
|
|
1682
|
+
/** Is active */
|
|
1683
|
+
isActive?: boolean;
|
|
1684
|
+
/** Flash sale items */
|
|
1685
|
+
items?: FlashSaleItemInput[];
|
|
1686
|
+
}
|
|
1687
|
+
/**
|
|
1688
|
+
* Update flash sale request
|
|
1689
|
+
*/
|
|
1690
|
+
interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {
|
|
1691
|
+
}
|
|
1573
1692
|
|
|
1574
1693
|
/**
|
|
1575
1694
|
* Ecommerce API Response Types
|
|
@@ -2019,6 +2138,38 @@ interface MessageResponse {
|
|
|
2019
2138
|
/** Message */
|
|
2020
2139
|
message: Message;
|
|
2021
2140
|
}
|
|
2141
|
+
/**
|
|
2142
|
+
* Customer messages response (for retail users)
|
|
2143
|
+
*
|
|
2144
|
+
* Groups messages by order, where each order represents a conversation with a merchant.
|
|
2145
|
+
*/
|
|
2146
|
+
interface CustomerMessagesResponse {
|
|
2147
|
+
/** Conversations grouped by order */
|
|
2148
|
+
conversations: Array<{
|
|
2149
|
+
orderId: string;
|
|
2150
|
+
orderNumber: string;
|
|
2151
|
+
merchant: {
|
|
2152
|
+
id: string;
|
|
2153
|
+
name: string;
|
|
2154
|
+
ownerUserId: string;
|
|
2155
|
+
};
|
|
2156
|
+
lastMessage: Message;
|
|
2157
|
+
unreadCount: number;
|
|
2158
|
+
messages: Message[];
|
|
2159
|
+
}>;
|
|
2160
|
+
/** Stats */
|
|
2161
|
+
stats: {
|
|
2162
|
+
total: number;
|
|
2163
|
+
unread: number;
|
|
2164
|
+
};
|
|
2165
|
+
}
|
|
2166
|
+
/**
|
|
2167
|
+
* Message stats response (for notification badges)
|
|
2168
|
+
*/
|
|
2169
|
+
interface MessageStatsResponse {
|
|
2170
|
+
/** Unread message count */
|
|
2171
|
+
unread: number;
|
|
2172
|
+
}
|
|
2022
2173
|
/**
|
|
2023
2174
|
* Analytics overview
|
|
2024
2175
|
*/
|
|
@@ -2297,6 +2448,22 @@ interface CreateOrderEventResponse {
|
|
|
2297
2448
|
/** Event */
|
|
2298
2449
|
event: any;
|
|
2299
2450
|
}
|
|
2451
|
+
/**
|
|
2452
|
+
* Active flash sales response
|
|
2453
|
+
*/
|
|
2454
|
+
interface ActiveFlashSalesResponse {
|
|
2455
|
+
/** Flash sales */
|
|
2456
|
+
flashSales: FlashSale[];
|
|
2457
|
+
/** Time remaining for the featured/first sale */
|
|
2458
|
+
timeRemaining: {
|
|
2459
|
+
/** End timestamp */
|
|
2460
|
+
endsAt: string;
|
|
2461
|
+
/** Remaining seconds */
|
|
2462
|
+
remainingSeconds: number;
|
|
2463
|
+
} | null;
|
|
2464
|
+
/** Server time (for client-side sync) */
|
|
2465
|
+
serverTime: string;
|
|
2466
|
+
}
|
|
2300
2467
|
|
|
2301
2468
|
/**
|
|
2302
2469
|
* Customer/End-User Ecommerce API Client
|
|
@@ -2675,6 +2842,93 @@ declare class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
2675
2842
|
* ```
|
|
2676
2843
|
*/
|
|
2677
2844
|
trackBanner(bannerId: string, request: TrackBannerRequest): Promise<SuccessResponse>;
|
|
2845
|
+
/**
|
|
2846
|
+
* List messages for customer
|
|
2847
|
+
*
|
|
2848
|
+
* Returns all conversations grouped by order, where each order represents
|
|
2849
|
+
* a conversation with a merchant.
|
|
2850
|
+
*
|
|
2851
|
+
* @returns List of conversations with messages and stats
|
|
2852
|
+
*
|
|
2853
|
+
* @example
|
|
2854
|
+
* ```typescript
|
|
2855
|
+
* const result = await client.listMessages();
|
|
2856
|
+
* console.log("Unread:", result.stats.unread);
|
|
2857
|
+
* result.conversations.forEach(conv => {
|
|
2858
|
+
* console.log(`Order ${conv.orderNumber}: ${conv.unreadCount} unread`);
|
|
2859
|
+
* });
|
|
2860
|
+
* ```
|
|
2861
|
+
*/
|
|
2862
|
+
listMessages(): Promise<CustomerMessagesResponse>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Get message stats (unread count)
|
|
2865
|
+
*
|
|
2866
|
+
* Lightweight endpoint for notification badges.
|
|
2867
|
+
*
|
|
2868
|
+
* @returns Unread message count
|
|
2869
|
+
*
|
|
2870
|
+
* @example
|
|
2871
|
+
* ```typescript
|
|
2872
|
+
* const stats = await client.getMessageStats();
|
|
2873
|
+
* console.log("Unread messages:", stats.unread);
|
|
2874
|
+
* ```
|
|
2875
|
+
*/
|
|
2876
|
+
getMessageStats(): Promise<MessageStatsResponse>;
|
|
2877
|
+
/**
|
|
2878
|
+
* Send a message to a merchant about an order
|
|
2879
|
+
*
|
|
2880
|
+
* @param request - Message data including orderId, recipientId (merchant user ID), and message
|
|
2881
|
+
* @returns Sent message
|
|
2882
|
+
*
|
|
2883
|
+
* @example
|
|
2884
|
+
* ```typescript
|
|
2885
|
+
* await client.sendMessage({
|
|
2886
|
+
* orderId: "ord_123",
|
|
2887
|
+
* recipientId: "user_merchant_456",
|
|
2888
|
+
* message: "When will my order ship?"
|
|
2889
|
+
* });
|
|
2890
|
+
* ```
|
|
2891
|
+
*/
|
|
2892
|
+
sendMessage(request: SendMessageRequest): Promise<MessageResponse>;
|
|
2893
|
+
/**
|
|
2894
|
+
* Mark a message as read
|
|
2895
|
+
*
|
|
2896
|
+
* @param messageId - Message ID
|
|
2897
|
+
* @returns Updated message
|
|
2898
|
+
*
|
|
2899
|
+
* @example
|
|
2900
|
+
* ```typescript
|
|
2901
|
+
* await client.markMessageAsRead("msg_123");
|
|
2902
|
+
* ```
|
|
2903
|
+
*/
|
|
2904
|
+
markMessageAsRead(messageId: string): Promise<MessageResponse>;
|
|
2905
|
+
/**
|
|
2906
|
+
* Get active flash sales
|
|
2907
|
+
*
|
|
2908
|
+
* Returns currently running flash sales with their discounted products.
|
|
2909
|
+
* Includes countdown timer information for UI display.
|
|
2910
|
+
*
|
|
2911
|
+
* @param params - Query parameters
|
|
2912
|
+
* @returns List of active flash sales with time remaining
|
|
2913
|
+
*
|
|
2914
|
+
* @example
|
|
2915
|
+
* ```typescript
|
|
2916
|
+
* const result = await client.getActiveFlashSales({ limit: 5 });
|
|
2917
|
+
*
|
|
2918
|
+
* result.flashSales.forEach(sale => {
|
|
2919
|
+
* console.log(`${sale.name} - ends at ${sale.endsAt}`);
|
|
2920
|
+
* sale.items.forEach(item => {
|
|
2921
|
+
* console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
|
|
2922
|
+
* });
|
|
2923
|
+
* });
|
|
2924
|
+
*
|
|
2925
|
+
* // Use timeRemaining for countdown UI
|
|
2926
|
+
* if (result.timeRemaining) {
|
|
2927
|
+
* console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
|
|
2928
|
+
* }
|
|
2929
|
+
* ```
|
|
2930
|
+
*/
|
|
2931
|
+
getActiveFlashSales(params?: ListActiveFlashSalesParams): Promise<ActiveFlashSalesResponse>;
|
|
2678
2932
|
}
|
|
2679
2933
|
|
|
2680
2934
|
/**
|
|
@@ -3729,4 +3983,4 @@ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAG
|
|
|
3729
3983
|
*/
|
|
3730
3984
|
declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
|
|
3731
3985
|
|
|
3732
|
-
export { 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 CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, 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 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 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 };
|
|
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 };
|
package/dist/ecommerce.js
CHANGED
|
@@ -727,6 +727,110 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
727
727
|
async trackBanner(bannerId, request) {
|
|
728
728
|
return this.post(`/api/marketplace/banners/${bannerId}/track`, request);
|
|
729
729
|
}
|
|
730
|
+
// ============================================================================
|
|
731
|
+
// Messages API
|
|
732
|
+
// ============================================================================
|
|
733
|
+
/**
|
|
734
|
+
* List messages for customer
|
|
735
|
+
*
|
|
736
|
+
* Returns all conversations grouped by order, where each order represents
|
|
737
|
+
* a conversation with a merchant.
|
|
738
|
+
*
|
|
739
|
+
* @returns List of conversations with messages and stats
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* const result = await client.listMessages();
|
|
744
|
+
* console.log("Unread:", result.stats.unread);
|
|
745
|
+
* result.conversations.forEach(conv => {
|
|
746
|
+
* console.log(`Order ${conv.orderNumber}: ${conv.unreadCount} unread`);
|
|
747
|
+
* });
|
|
748
|
+
* ```
|
|
749
|
+
*/
|
|
750
|
+
async listMessages() {
|
|
751
|
+
return this.get("/api/marketplace/messages");
|
|
752
|
+
}
|
|
753
|
+
/**
|
|
754
|
+
* Get message stats (unread count)
|
|
755
|
+
*
|
|
756
|
+
* Lightweight endpoint for notification badges.
|
|
757
|
+
*
|
|
758
|
+
* @returns Unread message count
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* ```typescript
|
|
762
|
+
* const stats = await client.getMessageStats();
|
|
763
|
+
* console.log("Unread messages:", stats.unread);
|
|
764
|
+
* ```
|
|
765
|
+
*/
|
|
766
|
+
async getMessageStats() {
|
|
767
|
+
return this.get("/api/marketplace/messages/stats");
|
|
768
|
+
}
|
|
769
|
+
/**
|
|
770
|
+
* Send a message to a merchant about an order
|
|
771
|
+
*
|
|
772
|
+
* @param request - Message data including orderId, recipientId (merchant user ID), and message
|
|
773
|
+
* @returns Sent message
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```typescript
|
|
777
|
+
* await client.sendMessage({
|
|
778
|
+
* orderId: "ord_123",
|
|
779
|
+
* recipientId: "user_merchant_456",
|
|
780
|
+
* message: "When will my order ship?"
|
|
781
|
+
* });
|
|
782
|
+
* ```
|
|
783
|
+
*/
|
|
784
|
+
async sendMessage(request) {
|
|
785
|
+
return this.post("/api/marketplace/messages/send", request);
|
|
786
|
+
}
|
|
787
|
+
/**
|
|
788
|
+
* Mark a message as read
|
|
789
|
+
*
|
|
790
|
+
* @param messageId - Message ID
|
|
791
|
+
* @returns Updated message
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```typescript
|
|
795
|
+
* await client.markMessageAsRead("msg_123");
|
|
796
|
+
* ```
|
|
797
|
+
*/
|
|
798
|
+
async markMessageAsRead(messageId) {
|
|
799
|
+
return this.patch(`/api/marketplace/messages/${messageId}/read`, {});
|
|
800
|
+
}
|
|
801
|
+
// ============================================================================
|
|
802
|
+
// Flash Sales API
|
|
803
|
+
// ============================================================================
|
|
804
|
+
/**
|
|
805
|
+
* Get active flash sales
|
|
806
|
+
*
|
|
807
|
+
* Returns currently running flash sales with their discounted products.
|
|
808
|
+
* Includes countdown timer information for UI display.
|
|
809
|
+
*
|
|
810
|
+
* @param params - Query parameters
|
|
811
|
+
* @returns List of active flash sales with time remaining
|
|
812
|
+
*
|
|
813
|
+
* @example
|
|
814
|
+
* ```typescript
|
|
815
|
+
* const result = await client.getActiveFlashSales({ limit: 5 });
|
|
816
|
+
*
|
|
817
|
+
* result.flashSales.forEach(sale => {
|
|
818
|
+
* console.log(`${sale.name} - ends at ${sale.endsAt}`);
|
|
819
|
+
* sale.items.forEach(item => {
|
|
820
|
+
* console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
|
|
821
|
+
* });
|
|
822
|
+
* });
|
|
823
|
+
*
|
|
824
|
+
* // Use timeRemaining for countdown UI
|
|
825
|
+
* if (result.timeRemaining) {
|
|
826
|
+
* console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
|
|
827
|
+
* }
|
|
828
|
+
* ```
|
|
829
|
+
*/
|
|
830
|
+
async getActiveFlashSales(params) {
|
|
831
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
832
|
+
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
833
|
+
}
|
|
730
834
|
};
|
|
731
835
|
|
|
732
836
|
// 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-MVFO4WRF.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 { AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, 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, 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, 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, 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';
|
|
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 { AnalyticsOverview, ApiResponse, AppliedDiscount, Banner, BannerResponse, BannerType, BaseEcommerceClient, BaseEntity, CalculateCartDiscountsRequest, CalculateCartDiscountsResponse, CalculateTaxRequest, CalculateTaxResponse, CartItem, ConfirmEscrowDepositResponse, Coupon, CouponResponse, CouponUsage, CreateBannerRequest, CreateCouponRequest, CreateOrderEventRequest, CreateOrderEventResponse, CreateOrderRequest, CreateOrderResponse, CreateProductRequest, CreateProductVariantRequest, CreateReviewRequest, CreateShippingMethodRequest, CreateTaxNexusRequest, CreateTaxRuleRequest, CustomerEcommerceClient, CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, EcommerceClientConfig, GenerateTaxReportRequest, GetAnalyticsParams, GetAnalyticsResponse, GetCouponResponse, GetOrderResponse, GetProductMetricsResponse, GetProductResponse, GetTaxReportResponse, InventoryAuditAction, InventoryAuditEntry, ListActiveBannersParams, 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, 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, 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, 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';
|
|
5
5
|
import 'axios';
|
|
6
6
|
|
|
7
7
|
declare function encodeSlug(slug: string): bigint;
|
package/dist/index.js
CHANGED
|
@@ -43047,6 +43047,110 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
43047
43047
|
async trackBanner(bannerId, request) {
|
|
43048
43048
|
return this.post(`/api/marketplace/banners/${bannerId}/track`, request);
|
|
43049
43049
|
}
|
|
43050
|
+
// ============================================================================
|
|
43051
|
+
// Messages API
|
|
43052
|
+
// ============================================================================
|
|
43053
|
+
/**
|
|
43054
|
+
* List messages for customer
|
|
43055
|
+
*
|
|
43056
|
+
* Returns all conversations grouped by order, where each order represents
|
|
43057
|
+
* a conversation with a merchant.
|
|
43058
|
+
*
|
|
43059
|
+
* @returns List of conversations with messages and stats
|
|
43060
|
+
*
|
|
43061
|
+
* @example
|
|
43062
|
+
* ```typescript
|
|
43063
|
+
* const result = await client.listMessages();
|
|
43064
|
+
* console.log("Unread:", result.stats.unread);
|
|
43065
|
+
* result.conversations.forEach(conv => {
|
|
43066
|
+
* console.log(`Order ${conv.orderNumber}: ${conv.unreadCount} unread`);
|
|
43067
|
+
* });
|
|
43068
|
+
* ```
|
|
43069
|
+
*/
|
|
43070
|
+
async listMessages() {
|
|
43071
|
+
return this.get("/api/marketplace/messages");
|
|
43072
|
+
}
|
|
43073
|
+
/**
|
|
43074
|
+
* Get message stats (unread count)
|
|
43075
|
+
*
|
|
43076
|
+
* Lightweight endpoint for notification badges.
|
|
43077
|
+
*
|
|
43078
|
+
* @returns Unread message count
|
|
43079
|
+
*
|
|
43080
|
+
* @example
|
|
43081
|
+
* ```typescript
|
|
43082
|
+
* const stats = await client.getMessageStats();
|
|
43083
|
+
* console.log("Unread messages:", stats.unread);
|
|
43084
|
+
* ```
|
|
43085
|
+
*/
|
|
43086
|
+
async getMessageStats() {
|
|
43087
|
+
return this.get("/api/marketplace/messages/stats");
|
|
43088
|
+
}
|
|
43089
|
+
/**
|
|
43090
|
+
* Send a message to a merchant about an order
|
|
43091
|
+
*
|
|
43092
|
+
* @param request - Message data including orderId, recipientId (merchant user ID), and message
|
|
43093
|
+
* @returns Sent message
|
|
43094
|
+
*
|
|
43095
|
+
* @example
|
|
43096
|
+
* ```typescript
|
|
43097
|
+
* await client.sendMessage({
|
|
43098
|
+
* orderId: "ord_123",
|
|
43099
|
+
* recipientId: "user_merchant_456",
|
|
43100
|
+
* message: "When will my order ship?"
|
|
43101
|
+
* });
|
|
43102
|
+
* ```
|
|
43103
|
+
*/
|
|
43104
|
+
async sendMessage(request) {
|
|
43105
|
+
return this.post("/api/marketplace/messages/send", request);
|
|
43106
|
+
}
|
|
43107
|
+
/**
|
|
43108
|
+
* Mark a message as read
|
|
43109
|
+
*
|
|
43110
|
+
* @param messageId - Message ID
|
|
43111
|
+
* @returns Updated message
|
|
43112
|
+
*
|
|
43113
|
+
* @example
|
|
43114
|
+
* ```typescript
|
|
43115
|
+
* await client.markMessageAsRead("msg_123");
|
|
43116
|
+
* ```
|
|
43117
|
+
*/
|
|
43118
|
+
async markMessageAsRead(messageId) {
|
|
43119
|
+
return this.patch(`/api/marketplace/messages/${messageId}/read`, {});
|
|
43120
|
+
}
|
|
43121
|
+
// ============================================================================
|
|
43122
|
+
// Flash Sales API
|
|
43123
|
+
// ============================================================================
|
|
43124
|
+
/**
|
|
43125
|
+
* Get active flash sales
|
|
43126
|
+
*
|
|
43127
|
+
* Returns currently running flash sales with their discounted products.
|
|
43128
|
+
* Includes countdown timer information for UI display.
|
|
43129
|
+
*
|
|
43130
|
+
* @param params - Query parameters
|
|
43131
|
+
* @returns List of active flash sales with time remaining
|
|
43132
|
+
*
|
|
43133
|
+
* @example
|
|
43134
|
+
* ```typescript
|
|
43135
|
+
* const result = await client.getActiveFlashSales({ limit: 5 });
|
|
43136
|
+
*
|
|
43137
|
+
* result.flashSales.forEach(sale => {
|
|
43138
|
+
* console.log(`${sale.name} - ends at ${sale.endsAt}`);
|
|
43139
|
+
* sale.items.forEach(item => {
|
|
43140
|
+
* console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
|
|
43141
|
+
* });
|
|
43142
|
+
* });
|
|
43143
|
+
*
|
|
43144
|
+
* // Use timeRemaining for countdown UI
|
|
43145
|
+
* if (result.timeRemaining) {
|
|
43146
|
+
* console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
|
|
43147
|
+
* }
|
|
43148
|
+
* ```
|
|
43149
|
+
*/
|
|
43150
|
+
async getActiveFlashSales(params) {
|
|
43151
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
43152
|
+
return this.get(`/api/marketplace/flash-sales/active${queryString}`);
|
|
43153
|
+
}
|
|
43050
43154
|
};
|
|
43051
43155
|
|
|
43052
43156
|
// 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-MVFO4WRF.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';
|