@basedone/core 0.2.0 → 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-4GAKANLT.mjs → chunk-Z5OW2FDP.mjs} +218 -0
- package/dist/ecommerce.d.mts +461 -1
- package/dist/ecommerce.d.ts +461 -1
- package/dist/ecommerce.js +218 -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 +218 -0
- package/dist/index.mjs +1 -1
- package/lib/ecommerce/FLASH_SALES.md +340 -0
- package/lib/ecommerce/QUICK_REFERENCE.md +26 -0
- package/lib/ecommerce/README.md +32 -0
- package/lib/ecommerce/client/customer.ts +249 -0
- package/lib/ecommerce/types/entities.ts +69 -0
- package/lib/ecommerce/types/requests.ts +79 -0
- package/lib/ecommerce/types/responses.ts +148 -0
- package/package.json +1 -1
|
@@ -720,3 +720,72 @@ export interface CustomerSummary {
|
|
|
720
720
|
firstOrderDate?: string;
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
+
/**
|
|
724
|
+
* Flash sale item entity
|
|
725
|
+
*/
|
|
726
|
+
export interface FlashSaleItem {
|
|
727
|
+
/** Item ID */
|
|
728
|
+
id: string;
|
|
729
|
+
/** Product ID */
|
|
730
|
+
productId: string;
|
|
731
|
+
/** Sale price in USDC */
|
|
732
|
+
salePrice: string;
|
|
733
|
+
/** Original price in USDC */
|
|
734
|
+
originalPrice: string;
|
|
735
|
+
/** Discount percentage */
|
|
736
|
+
discountPercent: number;
|
|
737
|
+
/** Maximum quantity available at this price */
|
|
738
|
+
maxQuantity: number | null;
|
|
739
|
+
/** Quantity sold at flash price */
|
|
740
|
+
soldQuantity: number;
|
|
741
|
+
/** Remaining quantity */
|
|
742
|
+
remainingQuantity: number | null;
|
|
743
|
+
/** Limit per customer */
|
|
744
|
+
limitPerCustomer: number | null;
|
|
745
|
+
/** Product details */
|
|
746
|
+
product: {
|
|
747
|
+
id: string;
|
|
748
|
+
title: string;
|
|
749
|
+
description?: string | null;
|
|
750
|
+
images: string[];
|
|
751
|
+
priceUSDC: string;
|
|
752
|
+
inventory: number | null;
|
|
753
|
+
soldCount: number;
|
|
754
|
+
averageRating: number | null;
|
|
755
|
+
reviewCount: number;
|
|
756
|
+
merchant?: {
|
|
757
|
+
id: string;
|
|
758
|
+
name: string;
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Flash sale entity
|
|
765
|
+
*/
|
|
766
|
+
export interface FlashSale {
|
|
767
|
+
/** Flash sale ID */
|
|
768
|
+
id: string;
|
|
769
|
+
/** Sale name */
|
|
770
|
+
name: string;
|
|
771
|
+
/** Description */
|
|
772
|
+
description?: string | null;
|
|
773
|
+
/** Start timestamp */
|
|
774
|
+
startsAt: string;
|
|
775
|
+
/** End timestamp */
|
|
776
|
+
endsAt: string;
|
|
777
|
+
/** Badge text (e.g., "Mall", "Hot Deal") */
|
|
778
|
+
badgeText?: string | null;
|
|
779
|
+
/** Badge color (hex) */
|
|
780
|
+
badgeColor?: string | null;
|
|
781
|
+
/** Priority (higher = shown first) */
|
|
782
|
+
priority: number;
|
|
783
|
+
/** Merchant information */
|
|
784
|
+
merchant?: {
|
|
785
|
+
id: string;
|
|
786
|
+
name: string;
|
|
787
|
+
} | null;
|
|
788
|
+
/** Flash sale items */
|
|
789
|
+
items: FlashSaleItem[];
|
|
790
|
+
}
|
|
791
|
+
|
|
@@ -523,3 +523,82 @@ export interface ListActiveBannersParams {
|
|
|
523
523
|
merchantId?: string;
|
|
524
524
|
}
|
|
525
525
|
|
|
526
|
+
/**
|
|
527
|
+
* List active flash sales params
|
|
528
|
+
*/
|
|
529
|
+
export interface ListActiveFlashSalesParams {
|
|
530
|
+
/** Maximum number of flash sales to return */
|
|
531
|
+
limit?: number;
|
|
532
|
+
/** Filter by merchant ID */
|
|
533
|
+
merchantId?: string;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Flash sale item input
|
|
538
|
+
*/
|
|
539
|
+
export interface FlashSaleItemInput {
|
|
540
|
+
/** Product ID */
|
|
541
|
+
productId: string;
|
|
542
|
+
/** Sale price in USDC */
|
|
543
|
+
salePrice: number;
|
|
544
|
+
/** Maximum quantity available */
|
|
545
|
+
maxQuantity?: number | null;
|
|
546
|
+
/** Limit per customer */
|
|
547
|
+
limitPerCustomer?: number;
|
|
548
|
+
/** Sort order */
|
|
549
|
+
sortOrder?: number;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Create flash sale request
|
|
554
|
+
*/
|
|
555
|
+
export interface CreateFlashSaleRequest {
|
|
556
|
+
/** Sale name */
|
|
557
|
+
name: string;
|
|
558
|
+
/** Description */
|
|
559
|
+
description?: string | null;
|
|
560
|
+
/** Start timestamp */
|
|
561
|
+
startsAt: string;
|
|
562
|
+
/** End timestamp */
|
|
563
|
+
endsAt: string;
|
|
564
|
+
/** Badge text */
|
|
565
|
+
badgeText?: string;
|
|
566
|
+
/** Badge color (hex) */
|
|
567
|
+
badgeColor?: string;
|
|
568
|
+
/** Priority (higher = shown first) */
|
|
569
|
+
priority?: number;
|
|
570
|
+
/** Is active */
|
|
571
|
+
isActive?: boolean;
|
|
572
|
+
/** Flash sale items */
|
|
573
|
+
items?: FlashSaleItemInput[];
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Update flash sale request
|
|
578
|
+
*/
|
|
579
|
+
export interface UpdateFlashSaleRequest extends Partial<CreateFlashSaleRequest> {}
|
|
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
|
+
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
CustomerSummary,
|
|
26
26
|
ProductVariant,
|
|
27
27
|
CouponUsage,
|
|
28
|
+
FlashSale,
|
|
28
29
|
} from "./entities";
|
|
29
30
|
|
|
30
31
|
/**
|
|
@@ -339,6 +340,102 @@ export interface MerchantProfileResponse {
|
|
|
339
340
|
merchant: Merchant;
|
|
340
341
|
}
|
|
341
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
|
+
|
|
342
439
|
/**
|
|
343
440
|
* List coupons response
|
|
344
441
|
*/
|
|
@@ -504,6 +601,40 @@ export interface MessageResponse {
|
|
|
504
601
|
message: Message;
|
|
505
602
|
}
|
|
506
603
|
|
|
604
|
+
/**
|
|
605
|
+
* Customer messages response (for retail users)
|
|
606
|
+
*
|
|
607
|
+
* Groups messages by order, where each order represents a conversation with a merchant.
|
|
608
|
+
*/
|
|
609
|
+
export interface CustomerMessagesResponse {
|
|
610
|
+
/** Conversations grouped by order */
|
|
611
|
+
conversations: Array<{
|
|
612
|
+
orderId: string;
|
|
613
|
+
orderNumber: string;
|
|
614
|
+
merchant: {
|
|
615
|
+
id: string;
|
|
616
|
+
name: string;
|
|
617
|
+
ownerUserId: string;
|
|
618
|
+
};
|
|
619
|
+
lastMessage: Message;
|
|
620
|
+
unreadCount: number;
|
|
621
|
+
messages: Message[];
|
|
622
|
+
}>;
|
|
623
|
+
/** Stats */
|
|
624
|
+
stats: {
|
|
625
|
+
total: number;
|
|
626
|
+
unread: number;
|
|
627
|
+
};
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
/**
|
|
631
|
+
* Message stats response (for notification badges)
|
|
632
|
+
*/
|
|
633
|
+
export interface MessageStatsResponse {
|
|
634
|
+
/** Unread message count */
|
|
635
|
+
unread: number;
|
|
636
|
+
}
|
|
637
|
+
|
|
507
638
|
/**
|
|
508
639
|
* Analytics overview
|
|
509
640
|
*/
|
|
@@ -803,3 +934,20 @@ export interface CreateOrderEventResponse {
|
|
|
803
934
|
event: any;
|
|
804
935
|
}
|
|
805
936
|
|
|
937
|
+
/**
|
|
938
|
+
* Active flash sales response
|
|
939
|
+
*/
|
|
940
|
+
export interface ActiveFlashSalesResponse {
|
|
941
|
+
/** Flash sales */
|
|
942
|
+
flashSales: FlashSale[];
|
|
943
|
+
/** Time remaining for the featured/first sale */
|
|
944
|
+
timeRemaining: {
|
|
945
|
+
/** End timestamp */
|
|
946
|
+
endsAt: string;
|
|
947
|
+
/** Remaining seconds */
|
|
948
|
+
remainingSeconds: number;
|
|
949
|
+
} | null;
|
|
950
|
+
/** Server time (for client-side sync) */
|
|
951
|
+
serverTime: string;
|
|
952
|
+
}
|
|
953
|
+
|