@basedone/core 0.2.6 → 0.2.8

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/ecommerce.js CHANGED
@@ -324,10 +324,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
324
324
  // ============================================================================
325
325
  /**
326
326
  * List products with filtering and pagination
327
- *
327
+ *
328
328
  * @param params - Query parameters for filtering
329
329
  * @returns Paginated list of products
330
- *
330
+ *
331
331
  * @example
332
332
  * ```typescript
333
333
  * const products = await client.listProducts({
@@ -347,10 +347,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
347
347
  }
348
348
  /**
349
349
  * Get product details by ID
350
- *
350
+ *
351
351
  * @param productId - Product ID
352
352
  * @returns Product details with merchant info, variants, and reviews
353
- *
353
+ *
354
354
  * @example
355
355
  * ```typescript
356
356
  * const product = await client.getProduct("prod_123");
@@ -362,10 +362,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
362
362
  }
363
363
  /**
364
364
  * Track product view (increment view count)
365
- *
365
+ *
366
366
  * @param productId - Product ID
367
367
  * @returns Success response
368
- *
368
+ *
369
369
  * @example
370
370
  * ```typescript
371
371
  * await client.trackProductView("prod_123");
@@ -376,10 +376,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
376
376
  }
377
377
  /**
378
378
  * Get active automatic discounts for a product
379
- *
379
+ *
380
380
  * @param productId - Product ID
381
381
  * @returns List of applicable discounts
382
- *
382
+ *
383
383
  * @example
384
384
  * ```typescript
385
385
  * const discounts = await client.getProductDiscounts("prod_123");
@@ -394,17 +394,17 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
394
394
  // ============================================================================
395
395
  /**
396
396
  * Create order from cart checkout
397
- *
397
+ *
398
398
  * Supports multi-merchant checkout - automatically splits orders by merchant.
399
- *
399
+ *
400
400
  * **IMPORTANT: Shipping Cost Security**
401
401
  * - Use `shippingRateId` to specify the selected shipping rate
402
402
  * - The server calculates shipping cost from the rate ID (never trust frontend costs)
403
403
  * - Get available rates from `calculateShippingOptions()` first
404
- *
404
+ *
405
405
  * @param request - Order creation request
406
406
  * @returns Created order(s) with payment instructions
407
- *
407
+ *
408
408
  * @example
409
409
  * ```typescript
410
410
  * // Step 1: Calculate available shipping options
@@ -414,10 +414,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
414
414
  * cartItems: [{ productId: "prod_123", quantity: 2, priceUSDC: 29.99 }],
415
415
  * orderSubtotal: 59.98
416
416
  * });
417
- *
417
+ *
418
418
  * // Step 2: Let user select a shipping option, get the rateId
419
419
  * const selectedRateId = shippingOptions.shippingOptions[0].rateId;
420
- *
420
+ *
421
421
  * // Step 3: Create order with shippingRateId (server validates and calculates cost)
422
422
  * const result = await client.createOrder({
423
423
  * items: [
@@ -437,7 +437,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
437
437
  * shippingRateId: selectedRateId, // Server validates and calculates cost
438
438
  * couponCode: "SAVE10"
439
439
  * });
440
- *
440
+ *
441
441
  * // For USDC escrow, deposit to the escrow address
442
442
  * if (result.escrow) {
443
443
  * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
@@ -449,10 +449,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
449
449
  }
450
450
  /**
451
451
  * List user's orders
452
- *
452
+ *
453
453
  * @param params - Query parameters for filtering
454
454
  * @returns Paginated list of orders
455
- *
455
+ *
456
456
  * @example
457
457
  * ```typescript
458
458
  * const orders = await client.listOrders({
@@ -468,10 +468,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
468
468
  }
469
469
  /**
470
470
  * Get order details by ID
471
- *
471
+ *
472
472
  * @param orderId - Order ID
473
473
  * @returns Order details with items, payment, and shipment info
474
- *
474
+ *
475
475
  * @example
476
476
  * ```typescript
477
477
  * const order = await client.getOrder("ord_123");
@@ -483,12 +483,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
483
483
  }
484
484
  /**
485
485
  * Confirm USDC escrow deposit for order payment
486
- *
486
+ *
487
487
  * Verifies the Hyperliquid transaction and updates order status.
488
- *
488
+ *
489
489
  * @param orderId - Order ID
490
490
  * @returns Confirmation response with transaction hash
491
- *
491
+ *
492
492
  * @example
493
493
  * ```typescript
494
494
  * // After depositing USDC to escrow address
@@ -497,14 +497,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
497
497
  * ```
498
498
  */
499
499
  async confirmEscrowDeposit(orderId) {
500
- return this.post(`/api/marketplace/orders/${orderId}/confirm-escrow-deposit`);
500
+ return this.post(
501
+ `/api/marketplace/orders/${orderId}/confirm-escrow-deposit`
502
+ );
501
503
  }
502
504
  /**
503
505
  * Get order receipt
504
- *
506
+ *
505
507
  * @param orderId - Order ID
506
508
  * @returns Order receipt for download/display
507
- *
509
+ *
508
510
  * @example
509
511
  * ```typescript
510
512
  * const receipt = await client.getOrderReceipt("ord_123");
@@ -519,11 +521,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
519
521
  // ============================================================================
520
522
  /**
521
523
  * List reviews for a product
522
- *
524
+ *
523
525
  * @param productId - Product ID
524
526
  * @param params - Query parameters
525
527
  * @returns Paginated list of reviews
526
- *
528
+ *
527
529
  * @example
528
530
  * ```typescript
529
531
  * const reviews = await client.listProductReviews("prod_123", {
@@ -534,17 +536,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
534
536
  */
535
537
  async listProductReviews(productId, params) {
536
538
  const queryString = params ? buildQueryString(params) : "";
537
- return this.get(`/api/marketplace/products/${productId}/reviews${queryString}`);
539
+ return this.get(
540
+ `/api/marketplace/products/${productId}/reviews${queryString}`
541
+ );
538
542
  }
539
543
  /**
540
544
  * Create a product review
541
- *
545
+ *
542
546
  * Requires authenticated user who has purchased the product.
543
- *
547
+ *
544
548
  * @param productId - Product ID
545
549
  * @param request - Review creation request
546
550
  * @returns Created review
547
- *
551
+ *
548
552
  * @example
549
553
  * ```typescript
550
554
  * const review = await client.createReview("prod_123", {
@@ -562,9 +566,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
562
566
  // ============================================================================
563
567
  /**
564
568
  * List saved shipping addresses
565
- *
569
+ *
566
570
  * @returns List of user's saved shipping addresses
567
- *
571
+ *
568
572
  * @example
569
573
  * ```typescript
570
574
  * const addresses = await client.listShippingAddresses();
@@ -576,10 +580,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
576
580
  }
577
581
  /**
578
582
  * Create a new shipping address
579
- *
583
+ *
580
584
  * @param request - Shipping address data
581
585
  * @returns Created address
582
- *
586
+ *
583
587
  * @example
584
588
  * ```typescript
585
589
  * const address = await client.createShippingAddress({
@@ -600,11 +604,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
600
604
  }
601
605
  /**
602
606
  * Update a shipping address
603
- *
607
+ *
604
608
  * @param addressId - Address ID
605
609
  * @param request - Updated address data
606
610
  * @returns Updated address
607
- *
611
+ *
608
612
  * @example
609
613
  * ```typescript
610
614
  * const address = await client.updateShippingAddress("addr_123", {
@@ -617,10 +621,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
617
621
  }
618
622
  /**
619
623
  * Delete a shipping address
620
- *
624
+ *
621
625
  * @param addressId - Address ID
622
626
  * @returns Success response
623
- *
627
+ *
624
628
  * @example
625
629
  * ```typescript
626
630
  * await client.deleteShippingAddress("addr_123");
@@ -634,10 +638,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
634
638
  // ============================================================================
635
639
  /**
636
640
  * Calculate automatic discounts for cart items
637
- *
641
+ *
638
642
  * @param request - Cart items
639
643
  * @returns Calculated discounts and totals
640
- *
644
+ *
641
645
  * @example
642
646
  * ```typescript
643
647
  * const result = await client.calculateCartDiscounts({
@@ -656,10 +660,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
656
660
  }
657
661
  /**
658
662
  * Validate a discount code for cart items
659
- *
663
+ *
660
664
  * @param request - Discount code and cart items
661
665
  * @returns Validation result with discount details
662
- *
666
+ *
663
667
  * @example
664
668
  * ```typescript
665
669
  * const result = await client.validateDiscountCode({
@@ -668,7 +672,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
668
672
  * { productId: "prod_123", quantity: 2 }
669
673
  * ]
670
674
  * });
671
- *
675
+ *
672
676
  * if (result.valid) {
673
677
  * console.log("Discount:", result.discount?.discountAmount);
674
678
  * } else {
@@ -684,10 +688,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
684
688
  // ============================================================================
685
689
  /**
686
690
  * Calculate tax for cart items based on shipping address
687
- *
691
+ *
688
692
  * @param request - Cart items and shipping address
689
693
  * @returns Tax calculation with breakdown
690
- *
694
+ *
691
695
  * @example
692
696
  * ```typescript
693
697
  * const result = await client.calculateTax({
@@ -712,10 +716,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
712
716
  // ============================================================================
713
717
  /**
714
718
  * Calculate shipping options for cart items
715
- *
719
+ *
716
720
  * @param request - Cart items, merchant, and destination
717
721
  * @returns Available shipping options with costs
718
- *
722
+ *
719
723
  * @example
720
724
  * ```typescript
721
725
  * const result = await client.calculateShippingOptions({
@@ -726,7 +730,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
726
730
  * destinationCountry: "US",
727
731
  * orderSubtotal: 99.99
728
732
  * });
729
- *
733
+ *
730
734
  * result.shippingOptions.forEach(opt => {
731
735
  * console.log(opt.name, opt.cost, opt.estimatedDelivery);
732
736
  * });
@@ -740,10 +744,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
740
744
  // ============================================================================
741
745
  /**
742
746
  * Get active promotional banners
743
- *
747
+ *
744
748
  * @param params - Query parameters
745
749
  * @returns List of active banners
746
- *
750
+ *
747
751
  * @example
748
752
  * ```typescript
749
753
  * const banners = await client.getActiveBanners({
@@ -758,16 +762,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
758
762
  }
759
763
  /**
760
764
  * Track banner impression or click
761
- *
765
+ *
762
766
  * @param bannerId - Banner ID
763
767
  * @param request - Track action (impression or click)
764
768
  * @returns Success response
765
- *
769
+ *
766
770
  * @example
767
771
  * ```typescript
768
772
  * // Track impression
769
773
  * await client.trackBanner("banner_123", { action: "impression" });
770
- *
774
+ *
771
775
  * // Track click
772
776
  * await client.trackBanner("banner_123", { action: "click" });
773
777
  * ```
@@ -780,12 +784,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
780
784
  // ============================================================================
781
785
  /**
782
786
  * List messages for customer
783
- *
787
+ *
784
788
  * Returns all conversations grouped by order, where each order represents
785
789
  * a conversation with a merchant.
786
- *
790
+ *
787
791
  * @returns List of conversations with messages and stats
788
- *
792
+ *
789
793
  * @example
790
794
  * ```typescript
791
795
  * const result = await client.listMessages();
@@ -800,11 +804,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
800
804
  }
801
805
  /**
802
806
  * Get message stats (unread count)
803
- *
807
+ *
804
808
  * Lightweight endpoint for notification badges.
805
- *
809
+ *
806
810
  * @returns Unread message count
807
- *
811
+ *
808
812
  * @example
809
813
  * ```typescript
810
814
  * const stats = await client.getMessageStats();
@@ -816,10 +820,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
816
820
  }
817
821
  /**
818
822
  * Send a message to a merchant about an order
819
- *
823
+ *
820
824
  * @param request - Message data including orderId, recipientId (merchant user ID), and message
821
825
  * @returns Sent message
822
- *
826
+ *
823
827
  * @example
824
828
  * ```typescript
825
829
  * await client.sendMessage({
@@ -834,10 +838,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
834
838
  }
835
839
  /**
836
840
  * Mark a message as read
837
- *
841
+ *
838
842
  * @param messageId - Message ID
839
843
  * @returns Updated message
840
- *
844
+ *
841
845
  * @example
842
846
  * ```typescript
843
847
  * await client.markMessageAsRead("msg_123");
@@ -851,24 +855,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
851
855
  // ============================================================================
852
856
  /**
853
857
  * Get active flash sales
854
- *
858
+ *
855
859
  * Returns currently running flash sales with their discounted products.
856
860
  * Includes countdown timer information for UI display.
857
- *
861
+ *
858
862
  * @param params - Query parameters
859
863
  * @returns List of active flash sales with time remaining
860
- *
864
+ *
861
865
  * @example
862
866
  * ```typescript
863
867
  * const result = await client.getActiveFlashSales({ limit: 5 });
864
- *
868
+ *
865
869
  * result.flashSales.forEach(sale => {
866
870
  * console.log(`${sale.name} - ends at ${sale.endsAt}`);
867
871
  * sale.items.forEach(item => {
868
872
  * console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
869
873
  * });
870
874
  * });
871
- *
875
+ *
872
876
  * // Use timeRemaining for countdown UI
873
877
  * if (result.timeRemaining) {
874
878
  * console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
@@ -881,19 +885,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
881
885
  }
882
886
  /**
883
887
  * Get flash sale allowance
884
- *
888
+ *
885
889
  * Fetches user's remaining purchase allowance for flash sale items.
886
890
  * Used to enforce per-customer purchase limits.
887
- *
891
+ *
888
892
  * @param params - Request params with product IDs
889
893
  * @returns Allowance info for each product
890
- *
894
+ *
891
895
  * @example
892
896
  * ```typescript
893
897
  * const result = await client.getFlashSaleAllowance({
894
898
  * productIds: ["prod_123", "prod_456"]
895
899
  * });
896
- *
900
+ *
897
901
  * Object.entries(result.allowances).forEach(([productId, info]) => {
898
902
  * if (info.limitPerCustomer !== null) {
899
903
  * console.log(`Product ${productId}:`);
@@ -905,7 +909,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
905
909
  * ```
906
910
  */
907
911
  async getFlashSaleAllowance(params) {
908
- const queryString = buildQueryString({ productIds: params.productIds.join(",") });
912
+ const queryString = buildQueryString({
913
+ productIds: params.productIds.join(",")
914
+ });
909
915
  return this.get(`/api/marketplace/flash-sales/allowance${queryString}`);
910
916
  }
911
917
  // ============================================================================
@@ -913,12 +919,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
913
919
  // ============================================================================
914
920
  /**
915
921
  * Get public merchant profile
916
- *
922
+ *
917
923
  * Fetches public information about a merchant for the storefront page.
918
- *
924
+ *
919
925
  * @param merchantId - Merchant ID
920
926
  * @returns Public merchant profile with stats
921
- *
927
+ *
922
928
  * @example
923
929
  * ```typescript
924
930
  * const result = await client.getMerchantProfile("merchant_123");
@@ -930,13 +936,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
930
936
  }
931
937
  /**
932
938
  * List merchant products
933
- *
939
+ *
934
940
  * Fetches products for a specific merchant with search, filter, and sort options.
935
- *
941
+ *
936
942
  * @param merchantId - Merchant ID
937
943
  * @param params - Query parameters for filtering and pagination
938
944
  * @returns Paginated list of products
939
- *
945
+ *
940
946
  * @example
941
947
  * ```typescript
942
948
  * const result = await client.getMerchantProducts("merchant_123", {
@@ -944,7 +950,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
944
950
  * sortBy: "popular",
945
951
  * limit: 20,
946
952
  * });
947
- *
953
+ *
948
954
  * result.items.forEach(product => {
949
955
  * console.log(product.title, product.priceUSDC);
950
956
  * });
@@ -952,17 +958,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
952
958
  */
953
959
  async getMerchantProducts(merchantId, params) {
954
960
  const queryString = params ? buildQueryString(params) : "";
955
- return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
961
+ return this.get(
962
+ `/api/marketplace/merchants/${merchantId}/products${queryString}`
963
+ );
956
964
  }
957
965
  // ============================================================================
958
966
  // Shop Following API
959
967
  // ============================================================================
960
968
  /**
961
969
  * Check if following a merchant
962
- *
970
+ *
963
971
  * @param merchantId - Merchant ID
964
972
  * @returns Follow status with follow date if applicable
965
- *
973
+ *
966
974
  * @example
967
975
  * ```typescript
968
976
  * const status = await client.isFollowingMerchant("merchant_123");
@@ -976,10 +984,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
976
984
  }
977
985
  /**
978
986
  * Follow a merchant
979
- *
987
+ *
980
988
  * @param merchantId - Merchant ID to follow
981
989
  * @returns Follow action result
982
- *
990
+ *
983
991
  * @example
984
992
  * ```typescript
985
993
  * const result = await client.followMerchant("merchant_123");
@@ -991,10 +999,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
991
999
  }
992
1000
  /**
993
1001
  * Unfollow a merchant
994
- *
1002
+ *
995
1003
  * @param merchantId - Merchant ID to unfollow
996
1004
  * @returns Unfollow action result
997
- *
1005
+ *
998
1006
  * @example
999
1007
  * ```typescript
1000
1008
  * const result = await client.unfollowMerchant("merchant_123");
@@ -1006,10 +1014,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1006
1014
  }
1007
1015
  /**
1008
1016
  * Get list of followed merchants
1009
- *
1017
+ *
1010
1018
  * @param params - Query parameters for pagination and sorting
1011
1019
  * @returns Paginated list of followed merchants with their info
1012
- *
1020
+ *
1013
1021
  * @example
1014
1022
  * ```typescript
1015
1023
  * const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
@@ -1027,11 +1035,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1027
1035
  // ============================================================================
1028
1036
  /**
1029
1037
  * Get available payment methods
1030
- *
1038
+ *
1031
1039
  * Returns the list of enabled payment methods that can be used during checkout.
1032
- *
1040
+ *
1033
1041
  * @returns List of available payment methods with display info
1034
- *
1042
+ *
1035
1043
  * @example
1036
1044
  * ```typescript
1037
1045
  * const result = await client.getPaymentMethods();
@@ -1050,12 +1058,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1050
1058
  // ============================================================================
1051
1059
  /**
1052
1060
  * Get user's gem balance
1053
- *
1061
+ *
1054
1062
  * Returns the current gem balance including total gems, available gems,
1055
1063
  * and gems expiring soon. Gems are earned at 100 per $1 of revenue.
1056
- *
1064
+ *
1057
1065
  * @returns Current gem balance with USD equivalent
1058
- *
1066
+ *
1059
1067
  * @example
1060
1068
  * ```typescript
1061
1069
  * const balance = await client.getGemBalance();
@@ -1068,24 +1076,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1068
1076
  }
1069
1077
  /**
1070
1078
  * Get gem transaction history
1071
- *
1079
+ *
1072
1080
  * Returns paginated history of gem transactions including earning,
1073
1081
  * spending, and expiration events.
1074
- *
1082
+ *
1075
1083
  * @param params - Query parameters for filtering and pagination
1076
1084
  * @returns Paginated gem history
1077
- *
1085
+ *
1078
1086
  * @example
1079
1087
  * ```typescript
1080
1088
  * // Get all history
1081
1089
  * const history = await client.getGemHistory({ limit: 20, offset: 0 });
1082
- *
1090
+ *
1083
1091
  * // Get only earned gems
1084
1092
  * const earned = await client.getGemHistory({ type: "earn", limit: 10 });
1085
- *
1093
+ *
1086
1094
  * // Get only spent gems
1087
1095
  * const spent = await client.getGemHistory({ type: "spend", limit: 10 });
1088
- *
1096
+ *
1089
1097
  * history.items.forEach(item => {
1090
1098
  * console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
1091
1099
  * });
@@ -1097,21 +1105,21 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1097
1105
  }
1098
1106
  /**
1099
1107
  * Get gems that are expiring soon
1100
- *
1108
+ *
1101
1109
  * Returns gem batches that will expire within the specified number of days.
1102
1110
  * Useful for prompting users to spend gems before they expire.
1103
- *
1111
+ *
1104
1112
  * @param params - Query parameters (days: default 30, max 180)
1105
1113
  * @returns Expiring gem batches with countdown info
1106
- *
1114
+ *
1107
1115
  * @example
1108
1116
  * ```typescript
1109
1117
  * // Get gems expiring in next 30 days (default)
1110
1118
  * const expiring = await client.getExpiringGems();
1111
- *
1119
+ *
1112
1120
  * // Get gems expiring in next 7 days
1113
1121
  * const urgent = await client.getExpiringGems({ days: 7 });
1114
- *
1122
+ *
1115
1123
  * if (expiring.totalExpiring > 0) {
1116
1124
  * console.log(`${expiring.totalExpiring} gems expiring soon!`);
1117
1125
  * expiring.batches.forEach(batch => {
@@ -1129,12 +1137,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1129
1137
  // ============================================================================
1130
1138
  /**
1131
1139
  * Get user's browsing location
1132
- *
1140
+ *
1133
1141
  * Returns the user's saved delivery location for geo-based product filtering.
1134
1142
  * This location is used to show products from merchants that ship to the area.
1135
- *
1143
+ *
1136
1144
  * @returns Current browsing location or null if not set
1137
- *
1145
+ *
1138
1146
  * @example
1139
1147
  * ```typescript
1140
1148
  * const result = await client.getBrowsingLocation();
@@ -1148,13 +1156,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1148
1156
  }
1149
1157
  /**
1150
1158
  * Save user's browsing location
1151
- *
1159
+ *
1152
1160
  * Sets the user's delivery location for geo-based product filtering.
1153
1161
  * Products will be filtered to show only items from merchants that ship to this location.
1154
- *
1162
+ *
1155
1163
  * @param request - Location data from Google Places or manual input
1156
1164
  * @returns The saved location
1157
- *
1165
+ *
1158
1166
  * @example
1159
1167
  * ```typescript
1160
1168
  * const result = await client.saveBrowsingLocation({
@@ -1172,12 +1180,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1172
1180
  }
1173
1181
  /**
1174
1182
  * Clear user's browsing location
1175
- *
1183
+ *
1176
1184
  * Removes the user's saved delivery location. Products will no longer
1177
1185
  * be filtered by shipping destination.
1178
- *
1186
+ *
1179
1187
  * @returns Success response
1180
- *
1188
+ *
1181
1189
  * @example
1182
1190
  * ```typescript
1183
1191
  * await client.clearBrowsingLocation();
@@ -1187,6 +1195,41 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1187
1195
  async clearBrowsingLocation() {
1188
1196
  return this.delete("/api/user/browsing-location");
1189
1197
  }
1198
+ // ============================================================================
1199
+ // BasedPay Cash Account API
1200
+ // ============================================================================
1201
+ /**
1202
+ * Get user's cash account balance for BASEDPAY
1203
+ *
1204
+ * Returns the current balance in the user's BasedPay cash account.
1205
+ *
1206
+ * @returns Cash account balance with currency
1207
+ *
1208
+ * @example
1209
+ * ```typescript
1210
+ * const balance = await client.getCashAccountBalance();
1211
+ * console.log(`Balance: ${balance.balance} ${balance.currency}`);
1212
+ * ```
1213
+ */
1214
+ async getCashAccountBalance() {
1215
+ return this.get("/api/basedpay/balance");
1216
+ }
1217
+ /**
1218
+ * Get user's delivery address for BASEDPAY
1219
+ *
1220
+ * Returns the user's delivery address for BASEDPAY.
1221
+ *
1222
+ * @returns Delivery address
1223
+ *
1224
+ * @example
1225
+ * ```typescript
1226
+ * const address = await client.getDeliveryAddress();
1227
+ * console.log(`Address: ${address.address}`);
1228
+ * ```
1229
+ */
1230
+ async getDeliveryAddress() {
1231
+ return this.get("/api/basedpay/delivery-address");
1232
+ }
1190
1233
  };
1191
1234
 
1192
1235
  // lib/ecommerce/client/merchant.ts
@@ -2757,6 +2800,22 @@ var MerchantStatus = /* @__PURE__ */ ((MerchantStatus2) => {
2757
2800
  MerchantStatus2["PENDING"] = "PENDING";
2758
2801
  return MerchantStatus2;
2759
2802
  })(MerchantStatus || {});
2803
+ var MerchantBusinessType = /* @__PURE__ */ ((MerchantBusinessType2) => {
2804
+ MerchantBusinessType2["INDIVIDUAL"] = "INDIVIDUAL";
2805
+ MerchantBusinessType2["COMPANY"] = "COMPANY";
2806
+ MerchantBusinessType2["PARTNERSHIP"] = "PARTNERSHIP";
2807
+ MerchantBusinessType2["NON_PROFIT"] = "NON_PROFIT";
2808
+ return MerchantBusinessType2;
2809
+ })(MerchantBusinessType || {});
2810
+ var MerchantReturnPolicyType = /* @__PURE__ */ ((MerchantReturnPolicyType2) => {
2811
+ MerchantReturnPolicyType2["NO_RETURNS"] = "NO_RETURNS";
2812
+ MerchantReturnPolicyType2["EXCHANGE_ONLY"] = "EXCHANGE_ONLY";
2813
+ MerchantReturnPolicyType2["STORE_CREDIT"] = "STORE_CREDIT";
2814
+ MerchantReturnPolicyType2["FULL_REFUND"] = "FULL_REFUND";
2815
+ MerchantReturnPolicyType2["PARTIAL_REFUND"] = "PARTIAL_REFUND";
2816
+ MerchantReturnPolicyType2["CASE_BY_CASE"] = "CASE_BY_CASE";
2817
+ return MerchantReturnPolicyType2;
2818
+ })(MerchantReturnPolicyType || {});
2760
2819
  var ShipmentStatus = /* @__PURE__ */ ((ShipmentStatus2) => {
2761
2820
  ShipmentStatus2["PENDING"] = "PENDING";
2762
2821
  ShipmentStatus2["SHIPPED"] = "SHIPPED";
@@ -2868,7 +2927,9 @@ exports.DiscountScope = DiscountScope;
2868
2927
  exports.DiscountType = DiscountType;
2869
2928
  exports.EcommerceApiError = EcommerceApiError;
2870
2929
  exports.InventoryAuditAction = InventoryAuditAction;
2930
+ exports.MerchantBusinessType = MerchantBusinessType;
2871
2931
  exports.MerchantEcommerceClient = MerchantEcommerceClient;
2932
+ exports.MerchantReturnPolicyType = MerchantReturnPolicyType;
2872
2933
  exports.MerchantStatus = MerchantStatus;
2873
2934
  exports.OrderStatus = OrderStatus;
2874
2935
  exports.PaymentMethod = PaymentMethod;