@basedone/core 0.2.5 → 0.2.7

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.
@@ -314,10 +314,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
314
314
  // ============================================================================
315
315
  /**
316
316
  * List products with filtering and pagination
317
- *
317
+ *
318
318
  * @param params - Query parameters for filtering
319
319
  * @returns Paginated list of products
320
- *
320
+ *
321
321
  * @example
322
322
  * ```typescript
323
323
  * const products = await client.listProducts({
@@ -337,10 +337,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
337
337
  }
338
338
  /**
339
339
  * Get product details by ID
340
- *
340
+ *
341
341
  * @param productId - Product ID
342
342
  * @returns Product details with merchant info, variants, and reviews
343
- *
343
+ *
344
344
  * @example
345
345
  * ```typescript
346
346
  * const product = await client.getProduct("prod_123");
@@ -352,10 +352,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
352
352
  }
353
353
  /**
354
354
  * Track product view (increment view count)
355
- *
355
+ *
356
356
  * @param productId - Product ID
357
357
  * @returns Success response
358
- *
358
+ *
359
359
  * @example
360
360
  * ```typescript
361
361
  * await client.trackProductView("prod_123");
@@ -366,10 +366,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
366
366
  }
367
367
  /**
368
368
  * Get active automatic discounts for a product
369
- *
369
+ *
370
370
  * @param productId - Product ID
371
371
  * @returns List of applicable discounts
372
- *
372
+ *
373
373
  * @example
374
374
  * ```typescript
375
375
  * const discounts = await client.getProductDiscounts("prod_123");
@@ -384,14 +384,31 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
384
384
  // ============================================================================
385
385
  /**
386
386
  * Create order from cart checkout
387
- *
387
+ *
388
388
  * Supports multi-merchant checkout - automatically splits orders by merchant.
389
- *
389
+ *
390
+ * **IMPORTANT: Shipping Cost Security**
391
+ * - Use `shippingRateId` to specify the selected shipping rate
392
+ * - The server calculates shipping cost from the rate ID (never trust frontend costs)
393
+ * - Get available rates from `calculateShippingOptions()` first
394
+ *
390
395
  * @param request - Order creation request
391
396
  * @returns Created order(s) with payment instructions
392
- *
397
+ *
393
398
  * @example
394
399
  * ```typescript
400
+ * // Step 1: Calculate available shipping options
401
+ * const shippingOptions = await client.calculateShippingOptions({
402
+ * merchantId: "merchant_123",
403
+ * destinationCountry: "US",
404
+ * cartItems: [{ productId: "prod_123", quantity: 2, priceUSDC: 29.99 }],
405
+ * orderSubtotal: 59.98
406
+ * });
407
+ *
408
+ * // Step 2: Let user select a shipping option, get the rateId
409
+ * const selectedRateId = shippingOptions.shippingOptions[0].rateId;
410
+ *
411
+ * // Step 3: Create order with shippingRateId (server validates and calculates cost)
395
412
  * const result = await client.createOrder({
396
413
  * items: [
397
414
  * { productId: "prod_123", quantity: 2 },
@@ -407,9 +424,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
407
424
  * postalCode: "10001",
408
425
  * country: "US"
409
426
  * },
427
+ * shippingRateId: selectedRateId, // Server validates and calculates cost
410
428
  * couponCode: "SAVE10"
411
429
  * });
412
- *
430
+ *
413
431
  * // For USDC escrow, deposit to the escrow address
414
432
  * if (result.escrow) {
415
433
  * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
@@ -421,10 +439,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
421
439
  }
422
440
  /**
423
441
  * List user's orders
424
- *
442
+ *
425
443
  * @param params - Query parameters for filtering
426
444
  * @returns Paginated list of orders
427
- *
445
+ *
428
446
  * @example
429
447
  * ```typescript
430
448
  * const orders = await client.listOrders({
@@ -440,10 +458,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
440
458
  }
441
459
  /**
442
460
  * Get order details by ID
443
- *
461
+ *
444
462
  * @param orderId - Order ID
445
463
  * @returns Order details with items, payment, and shipment info
446
- *
464
+ *
447
465
  * @example
448
466
  * ```typescript
449
467
  * const order = await client.getOrder("ord_123");
@@ -455,12 +473,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
455
473
  }
456
474
  /**
457
475
  * Confirm USDC escrow deposit for order payment
458
- *
476
+ *
459
477
  * Verifies the Hyperliquid transaction and updates order status.
460
- *
478
+ *
461
479
  * @param orderId - Order ID
462
480
  * @returns Confirmation response with transaction hash
463
- *
481
+ *
464
482
  * @example
465
483
  * ```typescript
466
484
  * // After depositing USDC to escrow address
@@ -469,14 +487,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
469
487
  * ```
470
488
  */
471
489
  async confirmEscrowDeposit(orderId) {
472
- return this.post(`/api/marketplace/orders/${orderId}/confirm-escrow-deposit`);
490
+ return this.post(
491
+ `/api/marketplace/orders/${orderId}/confirm-escrow-deposit`
492
+ );
473
493
  }
474
494
  /**
475
495
  * Get order receipt
476
- *
496
+ *
477
497
  * @param orderId - Order ID
478
498
  * @returns Order receipt for download/display
479
- *
499
+ *
480
500
  * @example
481
501
  * ```typescript
482
502
  * const receipt = await client.getOrderReceipt("ord_123");
@@ -491,11 +511,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
491
511
  // ============================================================================
492
512
  /**
493
513
  * List reviews for a product
494
- *
514
+ *
495
515
  * @param productId - Product ID
496
516
  * @param params - Query parameters
497
517
  * @returns Paginated list of reviews
498
- *
518
+ *
499
519
  * @example
500
520
  * ```typescript
501
521
  * const reviews = await client.listProductReviews("prod_123", {
@@ -506,17 +526,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
506
526
  */
507
527
  async listProductReviews(productId, params) {
508
528
  const queryString = params ? buildQueryString(params) : "";
509
- return this.get(`/api/marketplace/products/${productId}/reviews${queryString}`);
529
+ return this.get(
530
+ `/api/marketplace/products/${productId}/reviews${queryString}`
531
+ );
510
532
  }
511
533
  /**
512
534
  * Create a product review
513
- *
535
+ *
514
536
  * Requires authenticated user who has purchased the product.
515
- *
537
+ *
516
538
  * @param productId - Product ID
517
539
  * @param request - Review creation request
518
540
  * @returns Created review
519
- *
541
+ *
520
542
  * @example
521
543
  * ```typescript
522
544
  * const review = await client.createReview("prod_123", {
@@ -534,9 +556,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
534
556
  // ============================================================================
535
557
  /**
536
558
  * List saved shipping addresses
537
- *
559
+ *
538
560
  * @returns List of user's saved shipping addresses
539
- *
561
+ *
540
562
  * @example
541
563
  * ```typescript
542
564
  * const addresses = await client.listShippingAddresses();
@@ -548,10 +570,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
548
570
  }
549
571
  /**
550
572
  * Create a new shipping address
551
- *
573
+ *
552
574
  * @param request - Shipping address data
553
575
  * @returns Created address
554
- *
576
+ *
555
577
  * @example
556
578
  * ```typescript
557
579
  * const address = await client.createShippingAddress({
@@ -572,11 +594,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
572
594
  }
573
595
  /**
574
596
  * Update a shipping address
575
- *
597
+ *
576
598
  * @param addressId - Address ID
577
599
  * @param request - Updated address data
578
600
  * @returns Updated address
579
- *
601
+ *
580
602
  * @example
581
603
  * ```typescript
582
604
  * const address = await client.updateShippingAddress("addr_123", {
@@ -589,10 +611,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
589
611
  }
590
612
  /**
591
613
  * Delete a shipping address
592
- *
614
+ *
593
615
  * @param addressId - Address ID
594
616
  * @returns Success response
595
- *
617
+ *
596
618
  * @example
597
619
  * ```typescript
598
620
  * await client.deleteShippingAddress("addr_123");
@@ -606,10 +628,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
606
628
  // ============================================================================
607
629
  /**
608
630
  * Calculate automatic discounts for cart items
609
- *
631
+ *
610
632
  * @param request - Cart items
611
633
  * @returns Calculated discounts and totals
612
- *
634
+ *
613
635
  * @example
614
636
  * ```typescript
615
637
  * const result = await client.calculateCartDiscounts({
@@ -628,10 +650,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
628
650
  }
629
651
  /**
630
652
  * Validate a discount code for cart items
631
- *
653
+ *
632
654
  * @param request - Discount code and cart items
633
655
  * @returns Validation result with discount details
634
- *
656
+ *
635
657
  * @example
636
658
  * ```typescript
637
659
  * const result = await client.validateDiscountCode({
@@ -640,7 +662,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
640
662
  * { productId: "prod_123", quantity: 2 }
641
663
  * ]
642
664
  * });
643
- *
665
+ *
644
666
  * if (result.valid) {
645
667
  * console.log("Discount:", result.discount?.discountAmount);
646
668
  * } else {
@@ -656,10 +678,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
656
678
  // ============================================================================
657
679
  /**
658
680
  * Calculate tax for cart items based on shipping address
659
- *
681
+ *
660
682
  * @param request - Cart items and shipping address
661
683
  * @returns Tax calculation with breakdown
662
- *
684
+ *
663
685
  * @example
664
686
  * ```typescript
665
687
  * const result = await client.calculateTax({
@@ -684,10 +706,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
684
706
  // ============================================================================
685
707
  /**
686
708
  * Calculate shipping options for cart items
687
- *
709
+ *
688
710
  * @param request - Cart items, merchant, and destination
689
711
  * @returns Available shipping options with costs
690
- *
712
+ *
691
713
  * @example
692
714
  * ```typescript
693
715
  * const result = await client.calculateShippingOptions({
@@ -698,7 +720,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
698
720
  * destinationCountry: "US",
699
721
  * orderSubtotal: 99.99
700
722
  * });
701
- *
723
+ *
702
724
  * result.shippingOptions.forEach(opt => {
703
725
  * console.log(opt.name, opt.cost, opt.estimatedDelivery);
704
726
  * });
@@ -712,10 +734,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
712
734
  // ============================================================================
713
735
  /**
714
736
  * Get active promotional banners
715
- *
737
+ *
716
738
  * @param params - Query parameters
717
739
  * @returns List of active banners
718
- *
740
+ *
719
741
  * @example
720
742
  * ```typescript
721
743
  * const banners = await client.getActiveBanners({
@@ -730,16 +752,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
730
752
  }
731
753
  /**
732
754
  * Track banner impression or click
733
- *
755
+ *
734
756
  * @param bannerId - Banner ID
735
757
  * @param request - Track action (impression or click)
736
758
  * @returns Success response
737
- *
759
+ *
738
760
  * @example
739
761
  * ```typescript
740
762
  * // Track impression
741
763
  * await client.trackBanner("banner_123", { action: "impression" });
742
- *
764
+ *
743
765
  * // Track click
744
766
  * await client.trackBanner("banner_123", { action: "click" });
745
767
  * ```
@@ -752,12 +774,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
752
774
  // ============================================================================
753
775
  /**
754
776
  * List messages for customer
755
- *
777
+ *
756
778
  * Returns all conversations grouped by order, where each order represents
757
779
  * a conversation with a merchant.
758
- *
780
+ *
759
781
  * @returns List of conversations with messages and stats
760
- *
782
+ *
761
783
  * @example
762
784
  * ```typescript
763
785
  * const result = await client.listMessages();
@@ -772,11 +794,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
772
794
  }
773
795
  /**
774
796
  * Get message stats (unread count)
775
- *
797
+ *
776
798
  * Lightweight endpoint for notification badges.
777
- *
799
+ *
778
800
  * @returns Unread message count
779
- *
801
+ *
780
802
  * @example
781
803
  * ```typescript
782
804
  * const stats = await client.getMessageStats();
@@ -788,10 +810,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
788
810
  }
789
811
  /**
790
812
  * Send a message to a merchant about an order
791
- *
813
+ *
792
814
  * @param request - Message data including orderId, recipientId (merchant user ID), and message
793
815
  * @returns Sent message
794
- *
816
+ *
795
817
  * @example
796
818
  * ```typescript
797
819
  * await client.sendMessage({
@@ -806,10 +828,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
806
828
  }
807
829
  /**
808
830
  * Mark a message as read
809
- *
831
+ *
810
832
  * @param messageId - Message ID
811
833
  * @returns Updated message
812
- *
834
+ *
813
835
  * @example
814
836
  * ```typescript
815
837
  * await client.markMessageAsRead("msg_123");
@@ -823,24 +845,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
823
845
  // ============================================================================
824
846
  /**
825
847
  * Get active flash sales
826
- *
848
+ *
827
849
  * Returns currently running flash sales with their discounted products.
828
850
  * Includes countdown timer information for UI display.
829
- *
851
+ *
830
852
  * @param params - Query parameters
831
853
  * @returns List of active flash sales with time remaining
832
- *
854
+ *
833
855
  * @example
834
856
  * ```typescript
835
857
  * const result = await client.getActiveFlashSales({ limit: 5 });
836
- *
858
+ *
837
859
  * result.flashSales.forEach(sale => {
838
860
  * console.log(`${sale.name} - ends at ${sale.endsAt}`);
839
861
  * sale.items.forEach(item => {
840
862
  * console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
841
863
  * });
842
864
  * });
843
- *
865
+ *
844
866
  * // Use timeRemaining for countdown UI
845
867
  * if (result.timeRemaining) {
846
868
  * console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
@@ -853,19 +875,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
853
875
  }
854
876
  /**
855
877
  * Get flash sale allowance
856
- *
878
+ *
857
879
  * Fetches user's remaining purchase allowance for flash sale items.
858
880
  * Used to enforce per-customer purchase limits.
859
- *
881
+ *
860
882
  * @param params - Request params with product IDs
861
883
  * @returns Allowance info for each product
862
- *
884
+ *
863
885
  * @example
864
886
  * ```typescript
865
887
  * const result = await client.getFlashSaleAllowance({
866
888
  * productIds: ["prod_123", "prod_456"]
867
889
  * });
868
- *
890
+ *
869
891
  * Object.entries(result.allowances).forEach(([productId, info]) => {
870
892
  * if (info.limitPerCustomer !== null) {
871
893
  * console.log(`Product ${productId}:`);
@@ -877,7 +899,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
877
899
  * ```
878
900
  */
879
901
  async getFlashSaleAllowance(params) {
880
- const queryString = buildQueryString({ productIds: params.productIds.join(",") });
902
+ const queryString = buildQueryString({
903
+ productIds: params.productIds.join(",")
904
+ });
881
905
  return this.get(`/api/marketplace/flash-sales/allowance${queryString}`);
882
906
  }
883
907
  // ============================================================================
@@ -885,12 +909,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
885
909
  // ============================================================================
886
910
  /**
887
911
  * Get public merchant profile
888
- *
912
+ *
889
913
  * Fetches public information about a merchant for the storefront page.
890
- *
914
+ *
891
915
  * @param merchantId - Merchant ID
892
916
  * @returns Public merchant profile with stats
893
- *
917
+ *
894
918
  * @example
895
919
  * ```typescript
896
920
  * const result = await client.getMerchantProfile("merchant_123");
@@ -902,13 +926,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
902
926
  }
903
927
  /**
904
928
  * List merchant products
905
- *
929
+ *
906
930
  * Fetches products for a specific merchant with search, filter, and sort options.
907
- *
931
+ *
908
932
  * @param merchantId - Merchant ID
909
933
  * @param params - Query parameters for filtering and pagination
910
934
  * @returns Paginated list of products
911
- *
935
+ *
912
936
  * @example
913
937
  * ```typescript
914
938
  * const result = await client.getMerchantProducts("merchant_123", {
@@ -916,7 +940,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
916
940
  * sortBy: "popular",
917
941
  * limit: 20,
918
942
  * });
919
- *
943
+ *
920
944
  * result.items.forEach(product => {
921
945
  * console.log(product.title, product.priceUSDC);
922
946
  * });
@@ -924,17 +948,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
924
948
  */
925
949
  async getMerchantProducts(merchantId, params) {
926
950
  const queryString = params ? buildQueryString(params) : "";
927
- return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
951
+ return this.get(
952
+ `/api/marketplace/merchants/${merchantId}/products${queryString}`
953
+ );
928
954
  }
929
955
  // ============================================================================
930
956
  // Shop Following API
931
957
  // ============================================================================
932
958
  /**
933
959
  * Check if following a merchant
934
- *
960
+ *
935
961
  * @param merchantId - Merchant ID
936
962
  * @returns Follow status with follow date if applicable
937
- *
963
+ *
938
964
  * @example
939
965
  * ```typescript
940
966
  * const status = await client.isFollowingMerchant("merchant_123");
@@ -948,10 +974,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
948
974
  }
949
975
  /**
950
976
  * Follow a merchant
951
- *
977
+ *
952
978
  * @param merchantId - Merchant ID to follow
953
979
  * @returns Follow action result
954
- *
980
+ *
955
981
  * @example
956
982
  * ```typescript
957
983
  * const result = await client.followMerchant("merchant_123");
@@ -963,10 +989,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
963
989
  }
964
990
  /**
965
991
  * Unfollow a merchant
966
- *
992
+ *
967
993
  * @param merchantId - Merchant ID to unfollow
968
994
  * @returns Unfollow action result
969
- *
995
+ *
970
996
  * @example
971
997
  * ```typescript
972
998
  * const result = await client.unfollowMerchant("merchant_123");
@@ -978,10 +1004,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
978
1004
  }
979
1005
  /**
980
1006
  * Get list of followed merchants
981
- *
1007
+ *
982
1008
  * @param params - Query parameters for pagination and sorting
983
1009
  * @returns Paginated list of followed merchants with their info
984
- *
1010
+ *
985
1011
  * @example
986
1012
  * ```typescript
987
1013
  * const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
@@ -999,11 +1025,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
999
1025
  // ============================================================================
1000
1026
  /**
1001
1027
  * Get available payment methods
1002
- *
1028
+ *
1003
1029
  * Returns the list of enabled payment methods that can be used during checkout.
1004
- *
1030
+ *
1005
1031
  * @returns List of available payment methods with display info
1006
- *
1032
+ *
1007
1033
  * @example
1008
1034
  * ```typescript
1009
1035
  * const result = await client.getPaymentMethods();
@@ -1022,12 +1048,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1022
1048
  // ============================================================================
1023
1049
  /**
1024
1050
  * Get user's gem balance
1025
- *
1051
+ *
1026
1052
  * Returns the current gem balance including total gems, available gems,
1027
1053
  * and gems expiring soon. Gems are earned at 100 per $1 of revenue.
1028
- *
1054
+ *
1029
1055
  * @returns Current gem balance with USD equivalent
1030
- *
1056
+ *
1031
1057
  * @example
1032
1058
  * ```typescript
1033
1059
  * const balance = await client.getGemBalance();
@@ -1040,24 +1066,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1040
1066
  }
1041
1067
  /**
1042
1068
  * Get gem transaction history
1043
- *
1069
+ *
1044
1070
  * Returns paginated history of gem transactions including earning,
1045
1071
  * spending, and expiration events.
1046
- *
1072
+ *
1047
1073
  * @param params - Query parameters for filtering and pagination
1048
1074
  * @returns Paginated gem history
1049
- *
1075
+ *
1050
1076
  * @example
1051
1077
  * ```typescript
1052
1078
  * // Get all history
1053
1079
  * const history = await client.getGemHistory({ limit: 20, offset: 0 });
1054
- *
1080
+ *
1055
1081
  * // Get only earned gems
1056
1082
  * const earned = await client.getGemHistory({ type: "earn", limit: 10 });
1057
- *
1083
+ *
1058
1084
  * // Get only spent gems
1059
1085
  * const spent = await client.getGemHistory({ type: "spend", limit: 10 });
1060
- *
1086
+ *
1061
1087
  * history.items.forEach(item => {
1062
1088
  * console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
1063
1089
  * });
@@ -1069,21 +1095,21 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1069
1095
  }
1070
1096
  /**
1071
1097
  * Get gems that are expiring soon
1072
- *
1098
+ *
1073
1099
  * Returns gem batches that will expire within the specified number of days.
1074
1100
  * Useful for prompting users to spend gems before they expire.
1075
- *
1101
+ *
1076
1102
  * @param params - Query parameters (days: default 30, max 180)
1077
1103
  * @returns Expiring gem batches with countdown info
1078
- *
1104
+ *
1079
1105
  * @example
1080
1106
  * ```typescript
1081
1107
  * // Get gems expiring in next 30 days (default)
1082
1108
  * const expiring = await client.getExpiringGems();
1083
- *
1109
+ *
1084
1110
  * // Get gems expiring in next 7 days
1085
1111
  * const urgent = await client.getExpiringGems({ days: 7 });
1086
- *
1112
+ *
1087
1113
  * if (expiring.totalExpiring > 0) {
1088
1114
  * console.log(`${expiring.totalExpiring} gems expiring soon!`);
1089
1115
  * expiring.batches.forEach(batch => {
@@ -1101,12 +1127,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1101
1127
  // ============================================================================
1102
1128
  /**
1103
1129
  * Get user's browsing location
1104
- *
1130
+ *
1105
1131
  * Returns the user's saved delivery location for geo-based product filtering.
1106
1132
  * This location is used to show products from merchants that ship to the area.
1107
- *
1133
+ *
1108
1134
  * @returns Current browsing location or null if not set
1109
- *
1135
+ *
1110
1136
  * @example
1111
1137
  * ```typescript
1112
1138
  * const result = await client.getBrowsingLocation();
@@ -1120,13 +1146,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1120
1146
  }
1121
1147
  /**
1122
1148
  * Save user's browsing location
1123
- *
1149
+ *
1124
1150
  * Sets the user's delivery location for geo-based product filtering.
1125
1151
  * Products will be filtered to show only items from merchants that ship to this location.
1126
- *
1152
+ *
1127
1153
  * @param request - Location data from Google Places or manual input
1128
1154
  * @returns The saved location
1129
- *
1155
+ *
1130
1156
  * @example
1131
1157
  * ```typescript
1132
1158
  * const result = await client.saveBrowsingLocation({
@@ -1144,12 +1170,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1144
1170
  }
1145
1171
  /**
1146
1172
  * Clear user's browsing location
1147
- *
1173
+ *
1148
1174
  * Removes the user's saved delivery location. Products will no longer
1149
1175
  * be filtered by shipping destination.
1150
- *
1176
+ *
1151
1177
  * @returns Success response
1152
- *
1178
+ *
1153
1179
  * @example
1154
1180
  * ```typescript
1155
1181
  * await client.clearBrowsingLocation();
@@ -1159,6 +1185,41 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1159
1185
  async clearBrowsingLocation() {
1160
1186
  return this.delete("/api/user/browsing-location");
1161
1187
  }
1188
+ // ============================================================================
1189
+ // BasedPay Cash Account API
1190
+ // ============================================================================
1191
+ /**
1192
+ * Get user's cash account balance for BASEDPAY
1193
+ *
1194
+ * Returns the current balance in the user's BasedPay cash account.
1195
+ *
1196
+ * @returns Cash account balance with currency
1197
+ *
1198
+ * @example
1199
+ * ```typescript
1200
+ * const balance = await client.getCashAccountBalance();
1201
+ * console.log(`Balance: ${balance.balance} ${balance.currency}`);
1202
+ * ```
1203
+ */
1204
+ async getCashAccountBalance() {
1205
+ return this.get("/api/basedpay/balance");
1206
+ }
1207
+ /**
1208
+ * Get user's delivery address for BASEDPAY
1209
+ *
1210
+ * Returns the user's delivery address for BASEDPAY.
1211
+ *
1212
+ * @returns Delivery address
1213
+ *
1214
+ * @example
1215
+ * ```typescript
1216
+ * const address = await client.getDeliveryAddress();
1217
+ * console.log(`Address: ${address.address}`);
1218
+ * ```
1219
+ */
1220
+ async getDeliveryAddress() {
1221
+ return this.get("/api/basedpay/delivery-address");
1222
+ }
1162
1223
  };
1163
1224
 
1164
1225
  // lib/ecommerce/client/merchant.ts