@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.
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,14 +394,31 @@ 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
+ * **IMPORTANT: Shipping Cost Security**
401
+ * - Use `shippingRateId` to specify the selected shipping rate
402
+ * - The server calculates shipping cost from the rate ID (never trust frontend costs)
403
+ * - Get available rates from `calculateShippingOptions()` first
404
+ *
400
405
  * @param request - Order creation request
401
406
  * @returns Created order(s) with payment instructions
402
- *
407
+ *
403
408
  * @example
404
409
  * ```typescript
410
+ * // Step 1: Calculate available shipping options
411
+ * const shippingOptions = await client.calculateShippingOptions({
412
+ * merchantId: "merchant_123",
413
+ * destinationCountry: "US",
414
+ * cartItems: [{ productId: "prod_123", quantity: 2, priceUSDC: 29.99 }],
415
+ * orderSubtotal: 59.98
416
+ * });
417
+ *
418
+ * // Step 2: Let user select a shipping option, get the rateId
419
+ * const selectedRateId = shippingOptions.shippingOptions[0].rateId;
420
+ *
421
+ * // Step 3: Create order with shippingRateId (server validates and calculates cost)
405
422
  * const result = await client.createOrder({
406
423
  * items: [
407
424
  * { productId: "prod_123", quantity: 2 },
@@ -417,9 +434,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
417
434
  * postalCode: "10001",
418
435
  * country: "US"
419
436
  * },
437
+ * shippingRateId: selectedRateId, // Server validates and calculates cost
420
438
  * couponCode: "SAVE10"
421
439
  * });
422
- *
440
+ *
423
441
  * // For USDC escrow, deposit to the escrow address
424
442
  * if (result.escrow) {
425
443
  * console.log("Deposit", result.escrow.amountUSDC, "USDC to", result.escrow.address);
@@ -431,10 +449,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
431
449
  }
432
450
  /**
433
451
  * List user's orders
434
- *
452
+ *
435
453
  * @param params - Query parameters for filtering
436
454
  * @returns Paginated list of orders
437
- *
455
+ *
438
456
  * @example
439
457
  * ```typescript
440
458
  * const orders = await client.listOrders({
@@ -450,10 +468,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
450
468
  }
451
469
  /**
452
470
  * Get order details by ID
453
- *
471
+ *
454
472
  * @param orderId - Order ID
455
473
  * @returns Order details with items, payment, and shipment info
456
- *
474
+ *
457
475
  * @example
458
476
  * ```typescript
459
477
  * const order = await client.getOrder("ord_123");
@@ -465,12 +483,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
465
483
  }
466
484
  /**
467
485
  * Confirm USDC escrow deposit for order payment
468
- *
486
+ *
469
487
  * Verifies the Hyperliquid transaction and updates order status.
470
- *
488
+ *
471
489
  * @param orderId - Order ID
472
490
  * @returns Confirmation response with transaction hash
473
- *
491
+ *
474
492
  * @example
475
493
  * ```typescript
476
494
  * // After depositing USDC to escrow address
@@ -479,14 +497,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
479
497
  * ```
480
498
  */
481
499
  async confirmEscrowDeposit(orderId) {
482
- return this.post(`/api/marketplace/orders/${orderId}/confirm-escrow-deposit`);
500
+ return this.post(
501
+ `/api/marketplace/orders/${orderId}/confirm-escrow-deposit`
502
+ );
483
503
  }
484
504
  /**
485
505
  * Get order receipt
486
- *
506
+ *
487
507
  * @param orderId - Order ID
488
508
  * @returns Order receipt for download/display
489
- *
509
+ *
490
510
  * @example
491
511
  * ```typescript
492
512
  * const receipt = await client.getOrderReceipt("ord_123");
@@ -501,11 +521,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
501
521
  // ============================================================================
502
522
  /**
503
523
  * List reviews for a product
504
- *
524
+ *
505
525
  * @param productId - Product ID
506
526
  * @param params - Query parameters
507
527
  * @returns Paginated list of reviews
508
- *
528
+ *
509
529
  * @example
510
530
  * ```typescript
511
531
  * const reviews = await client.listProductReviews("prod_123", {
@@ -516,17 +536,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
516
536
  */
517
537
  async listProductReviews(productId, params) {
518
538
  const queryString = params ? buildQueryString(params) : "";
519
- return this.get(`/api/marketplace/products/${productId}/reviews${queryString}`);
539
+ return this.get(
540
+ `/api/marketplace/products/${productId}/reviews${queryString}`
541
+ );
520
542
  }
521
543
  /**
522
544
  * Create a product review
523
- *
545
+ *
524
546
  * Requires authenticated user who has purchased the product.
525
- *
547
+ *
526
548
  * @param productId - Product ID
527
549
  * @param request - Review creation request
528
550
  * @returns Created review
529
- *
551
+ *
530
552
  * @example
531
553
  * ```typescript
532
554
  * const review = await client.createReview("prod_123", {
@@ -544,9 +566,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
544
566
  // ============================================================================
545
567
  /**
546
568
  * List saved shipping addresses
547
- *
569
+ *
548
570
  * @returns List of user's saved shipping addresses
549
- *
571
+ *
550
572
  * @example
551
573
  * ```typescript
552
574
  * const addresses = await client.listShippingAddresses();
@@ -558,10 +580,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
558
580
  }
559
581
  /**
560
582
  * Create a new shipping address
561
- *
583
+ *
562
584
  * @param request - Shipping address data
563
585
  * @returns Created address
564
- *
586
+ *
565
587
  * @example
566
588
  * ```typescript
567
589
  * const address = await client.createShippingAddress({
@@ -582,11 +604,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
582
604
  }
583
605
  /**
584
606
  * Update a shipping address
585
- *
607
+ *
586
608
  * @param addressId - Address ID
587
609
  * @param request - Updated address data
588
610
  * @returns Updated address
589
- *
611
+ *
590
612
  * @example
591
613
  * ```typescript
592
614
  * const address = await client.updateShippingAddress("addr_123", {
@@ -599,10 +621,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
599
621
  }
600
622
  /**
601
623
  * Delete a shipping address
602
- *
624
+ *
603
625
  * @param addressId - Address ID
604
626
  * @returns Success response
605
- *
627
+ *
606
628
  * @example
607
629
  * ```typescript
608
630
  * await client.deleteShippingAddress("addr_123");
@@ -616,10 +638,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
616
638
  // ============================================================================
617
639
  /**
618
640
  * Calculate automatic discounts for cart items
619
- *
641
+ *
620
642
  * @param request - Cart items
621
643
  * @returns Calculated discounts and totals
622
- *
644
+ *
623
645
  * @example
624
646
  * ```typescript
625
647
  * const result = await client.calculateCartDiscounts({
@@ -638,10 +660,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
638
660
  }
639
661
  /**
640
662
  * Validate a discount code for cart items
641
- *
663
+ *
642
664
  * @param request - Discount code and cart items
643
665
  * @returns Validation result with discount details
644
- *
666
+ *
645
667
  * @example
646
668
  * ```typescript
647
669
  * const result = await client.validateDiscountCode({
@@ -650,7 +672,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
650
672
  * { productId: "prod_123", quantity: 2 }
651
673
  * ]
652
674
  * });
653
- *
675
+ *
654
676
  * if (result.valid) {
655
677
  * console.log("Discount:", result.discount?.discountAmount);
656
678
  * } else {
@@ -666,10 +688,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
666
688
  // ============================================================================
667
689
  /**
668
690
  * Calculate tax for cart items based on shipping address
669
- *
691
+ *
670
692
  * @param request - Cart items and shipping address
671
693
  * @returns Tax calculation with breakdown
672
- *
694
+ *
673
695
  * @example
674
696
  * ```typescript
675
697
  * const result = await client.calculateTax({
@@ -694,10 +716,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
694
716
  // ============================================================================
695
717
  /**
696
718
  * Calculate shipping options for cart items
697
- *
719
+ *
698
720
  * @param request - Cart items, merchant, and destination
699
721
  * @returns Available shipping options with costs
700
- *
722
+ *
701
723
  * @example
702
724
  * ```typescript
703
725
  * const result = await client.calculateShippingOptions({
@@ -708,7 +730,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
708
730
  * destinationCountry: "US",
709
731
  * orderSubtotal: 99.99
710
732
  * });
711
- *
733
+ *
712
734
  * result.shippingOptions.forEach(opt => {
713
735
  * console.log(opt.name, opt.cost, opt.estimatedDelivery);
714
736
  * });
@@ -722,10 +744,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
722
744
  // ============================================================================
723
745
  /**
724
746
  * Get active promotional banners
725
- *
747
+ *
726
748
  * @param params - Query parameters
727
749
  * @returns List of active banners
728
- *
750
+ *
729
751
  * @example
730
752
  * ```typescript
731
753
  * const banners = await client.getActiveBanners({
@@ -740,16 +762,16 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
740
762
  }
741
763
  /**
742
764
  * Track banner impression or click
743
- *
765
+ *
744
766
  * @param bannerId - Banner ID
745
767
  * @param request - Track action (impression or click)
746
768
  * @returns Success response
747
- *
769
+ *
748
770
  * @example
749
771
  * ```typescript
750
772
  * // Track impression
751
773
  * await client.trackBanner("banner_123", { action: "impression" });
752
- *
774
+ *
753
775
  * // Track click
754
776
  * await client.trackBanner("banner_123", { action: "click" });
755
777
  * ```
@@ -762,12 +784,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
762
784
  // ============================================================================
763
785
  /**
764
786
  * List messages for customer
765
- *
787
+ *
766
788
  * Returns all conversations grouped by order, where each order represents
767
789
  * a conversation with a merchant.
768
- *
790
+ *
769
791
  * @returns List of conversations with messages and stats
770
- *
792
+ *
771
793
  * @example
772
794
  * ```typescript
773
795
  * const result = await client.listMessages();
@@ -782,11 +804,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
782
804
  }
783
805
  /**
784
806
  * Get message stats (unread count)
785
- *
807
+ *
786
808
  * Lightweight endpoint for notification badges.
787
- *
809
+ *
788
810
  * @returns Unread message count
789
- *
811
+ *
790
812
  * @example
791
813
  * ```typescript
792
814
  * const stats = await client.getMessageStats();
@@ -798,10 +820,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
798
820
  }
799
821
  /**
800
822
  * Send a message to a merchant about an order
801
- *
823
+ *
802
824
  * @param request - Message data including orderId, recipientId (merchant user ID), and message
803
825
  * @returns Sent message
804
- *
826
+ *
805
827
  * @example
806
828
  * ```typescript
807
829
  * await client.sendMessage({
@@ -816,10 +838,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
816
838
  }
817
839
  /**
818
840
  * Mark a message as read
819
- *
841
+ *
820
842
  * @param messageId - Message ID
821
843
  * @returns Updated message
822
- *
844
+ *
823
845
  * @example
824
846
  * ```typescript
825
847
  * await client.markMessageAsRead("msg_123");
@@ -833,24 +855,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
833
855
  // ============================================================================
834
856
  /**
835
857
  * Get active flash sales
836
- *
858
+ *
837
859
  * Returns currently running flash sales with their discounted products.
838
860
  * Includes countdown timer information for UI display.
839
- *
861
+ *
840
862
  * @param params - Query parameters
841
863
  * @returns List of active flash sales with time remaining
842
- *
864
+ *
843
865
  * @example
844
866
  * ```typescript
845
867
  * const result = await client.getActiveFlashSales({ limit: 5 });
846
- *
868
+ *
847
869
  * result.flashSales.forEach(sale => {
848
870
  * console.log(`${sale.name} - ends at ${sale.endsAt}`);
849
871
  * sale.items.forEach(item => {
850
872
  * console.log(` ${item.product.title}: $${item.salePrice} (${item.discountPercent}% off)`);
851
873
  * });
852
874
  * });
853
- *
875
+ *
854
876
  * // Use timeRemaining for countdown UI
855
877
  * if (result.timeRemaining) {
856
878
  * console.log(`Featured sale ends in ${result.timeRemaining.remainingSeconds} seconds`);
@@ -863,19 +885,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
863
885
  }
864
886
  /**
865
887
  * Get flash sale allowance
866
- *
888
+ *
867
889
  * Fetches user's remaining purchase allowance for flash sale items.
868
890
  * Used to enforce per-customer purchase limits.
869
- *
891
+ *
870
892
  * @param params - Request params with product IDs
871
893
  * @returns Allowance info for each product
872
- *
894
+ *
873
895
  * @example
874
896
  * ```typescript
875
897
  * const result = await client.getFlashSaleAllowance({
876
898
  * productIds: ["prod_123", "prod_456"]
877
899
  * });
878
- *
900
+ *
879
901
  * Object.entries(result.allowances).forEach(([productId, info]) => {
880
902
  * if (info.limitPerCustomer !== null) {
881
903
  * console.log(`Product ${productId}:`);
@@ -887,7 +909,9 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
887
909
  * ```
888
910
  */
889
911
  async getFlashSaleAllowance(params) {
890
- const queryString = buildQueryString({ productIds: params.productIds.join(",") });
912
+ const queryString = buildQueryString({
913
+ productIds: params.productIds.join(",")
914
+ });
891
915
  return this.get(`/api/marketplace/flash-sales/allowance${queryString}`);
892
916
  }
893
917
  // ============================================================================
@@ -895,12 +919,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
895
919
  // ============================================================================
896
920
  /**
897
921
  * Get public merchant profile
898
- *
922
+ *
899
923
  * Fetches public information about a merchant for the storefront page.
900
- *
924
+ *
901
925
  * @param merchantId - Merchant ID
902
926
  * @returns Public merchant profile with stats
903
- *
927
+ *
904
928
  * @example
905
929
  * ```typescript
906
930
  * const result = await client.getMerchantProfile("merchant_123");
@@ -912,13 +936,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
912
936
  }
913
937
  /**
914
938
  * List merchant products
915
- *
939
+ *
916
940
  * Fetches products for a specific merchant with search, filter, and sort options.
917
- *
941
+ *
918
942
  * @param merchantId - Merchant ID
919
943
  * @param params - Query parameters for filtering and pagination
920
944
  * @returns Paginated list of products
921
- *
945
+ *
922
946
  * @example
923
947
  * ```typescript
924
948
  * const result = await client.getMerchantProducts("merchant_123", {
@@ -926,7 +950,7 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
926
950
  * sortBy: "popular",
927
951
  * limit: 20,
928
952
  * });
929
- *
953
+ *
930
954
  * result.items.forEach(product => {
931
955
  * console.log(product.title, product.priceUSDC);
932
956
  * });
@@ -934,17 +958,19 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
934
958
  */
935
959
  async getMerchantProducts(merchantId, params) {
936
960
  const queryString = params ? buildQueryString(params) : "";
937
- return this.get(`/api/marketplace/merchants/${merchantId}/products${queryString}`);
961
+ return this.get(
962
+ `/api/marketplace/merchants/${merchantId}/products${queryString}`
963
+ );
938
964
  }
939
965
  // ============================================================================
940
966
  // Shop Following API
941
967
  // ============================================================================
942
968
  /**
943
969
  * Check if following a merchant
944
- *
970
+ *
945
971
  * @param merchantId - Merchant ID
946
972
  * @returns Follow status with follow date if applicable
947
- *
973
+ *
948
974
  * @example
949
975
  * ```typescript
950
976
  * const status = await client.isFollowingMerchant("merchant_123");
@@ -958,10 +984,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
958
984
  }
959
985
  /**
960
986
  * Follow a merchant
961
- *
987
+ *
962
988
  * @param merchantId - Merchant ID to follow
963
989
  * @returns Follow action result
964
- *
990
+ *
965
991
  * @example
966
992
  * ```typescript
967
993
  * const result = await client.followMerchant("merchant_123");
@@ -973,10 +999,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
973
999
  }
974
1000
  /**
975
1001
  * Unfollow a merchant
976
- *
1002
+ *
977
1003
  * @param merchantId - Merchant ID to unfollow
978
1004
  * @returns Unfollow action result
979
- *
1005
+ *
980
1006
  * @example
981
1007
  * ```typescript
982
1008
  * const result = await client.unfollowMerchant("merchant_123");
@@ -988,10 +1014,10 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
988
1014
  }
989
1015
  /**
990
1016
  * Get list of followed merchants
991
- *
1017
+ *
992
1018
  * @param params - Query parameters for pagination and sorting
993
1019
  * @returns Paginated list of followed merchants with their info
994
- *
1020
+ *
995
1021
  * @example
996
1022
  * ```typescript
997
1023
  * const result = await client.getFollowedMerchants({ limit: 20, sortBy: "recent" });
@@ -1009,11 +1035,11 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1009
1035
  // ============================================================================
1010
1036
  /**
1011
1037
  * Get available payment methods
1012
- *
1038
+ *
1013
1039
  * Returns the list of enabled payment methods that can be used during checkout.
1014
- *
1040
+ *
1015
1041
  * @returns List of available payment methods with display info
1016
- *
1042
+ *
1017
1043
  * @example
1018
1044
  * ```typescript
1019
1045
  * const result = await client.getPaymentMethods();
@@ -1032,12 +1058,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1032
1058
  // ============================================================================
1033
1059
  /**
1034
1060
  * Get user's gem balance
1035
- *
1061
+ *
1036
1062
  * Returns the current gem balance including total gems, available gems,
1037
1063
  * and gems expiring soon. Gems are earned at 100 per $1 of revenue.
1038
- *
1064
+ *
1039
1065
  * @returns Current gem balance with USD equivalent
1040
- *
1066
+ *
1041
1067
  * @example
1042
1068
  * ```typescript
1043
1069
  * const balance = await client.getGemBalance();
@@ -1050,24 +1076,24 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1050
1076
  }
1051
1077
  /**
1052
1078
  * Get gem transaction history
1053
- *
1079
+ *
1054
1080
  * Returns paginated history of gem transactions including earning,
1055
1081
  * spending, and expiration events.
1056
- *
1082
+ *
1057
1083
  * @param params - Query parameters for filtering and pagination
1058
1084
  * @returns Paginated gem history
1059
- *
1085
+ *
1060
1086
  * @example
1061
1087
  * ```typescript
1062
1088
  * // Get all history
1063
1089
  * const history = await client.getGemHistory({ limit: 20, offset: 0 });
1064
- *
1090
+ *
1065
1091
  * // Get only earned gems
1066
1092
  * const earned = await client.getGemHistory({ type: "earn", limit: 10 });
1067
- *
1093
+ *
1068
1094
  * // Get only spent gems
1069
1095
  * const spent = await client.getGemHistory({ type: "spend", limit: 10 });
1070
- *
1096
+ *
1071
1097
  * history.items.forEach(item => {
1072
1098
  * console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
1073
1099
  * });
@@ -1079,21 +1105,21 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1079
1105
  }
1080
1106
  /**
1081
1107
  * Get gems that are expiring soon
1082
- *
1108
+ *
1083
1109
  * Returns gem batches that will expire within the specified number of days.
1084
1110
  * Useful for prompting users to spend gems before they expire.
1085
- *
1111
+ *
1086
1112
  * @param params - Query parameters (days: default 30, max 180)
1087
1113
  * @returns Expiring gem batches with countdown info
1088
- *
1114
+ *
1089
1115
  * @example
1090
1116
  * ```typescript
1091
1117
  * // Get gems expiring in next 30 days (default)
1092
1118
  * const expiring = await client.getExpiringGems();
1093
- *
1119
+ *
1094
1120
  * // Get gems expiring in next 7 days
1095
1121
  * const urgent = await client.getExpiringGems({ days: 7 });
1096
- *
1122
+ *
1097
1123
  * if (expiring.totalExpiring > 0) {
1098
1124
  * console.log(`${expiring.totalExpiring} gems expiring soon!`);
1099
1125
  * expiring.batches.forEach(batch => {
@@ -1111,12 +1137,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1111
1137
  // ============================================================================
1112
1138
  /**
1113
1139
  * Get user's browsing location
1114
- *
1140
+ *
1115
1141
  * Returns the user's saved delivery location for geo-based product filtering.
1116
1142
  * This location is used to show products from merchants that ship to the area.
1117
- *
1143
+ *
1118
1144
  * @returns Current browsing location or null if not set
1119
- *
1145
+ *
1120
1146
  * @example
1121
1147
  * ```typescript
1122
1148
  * const result = await client.getBrowsingLocation();
@@ -1130,13 +1156,13 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1130
1156
  }
1131
1157
  /**
1132
1158
  * Save user's browsing location
1133
- *
1159
+ *
1134
1160
  * Sets the user's delivery location for geo-based product filtering.
1135
1161
  * Products will be filtered to show only items from merchants that ship to this location.
1136
- *
1162
+ *
1137
1163
  * @param request - Location data from Google Places or manual input
1138
1164
  * @returns The saved location
1139
- *
1165
+ *
1140
1166
  * @example
1141
1167
  * ```typescript
1142
1168
  * const result = await client.saveBrowsingLocation({
@@ -1154,12 +1180,12 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1154
1180
  }
1155
1181
  /**
1156
1182
  * Clear user's browsing location
1157
- *
1183
+ *
1158
1184
  * Removes the user's saved delivery location. Products will no longer
1159
1185
  * be filtered by shipping destination.
1160
- *
1186
+ *
1161
1187
  * @returns Success response
1162
- *
1188
+ *
1163
1189
  * @example
1164
1190
  * ```typescript
1165
1191
  * await client.clearBrowsingLocation();
@@ -1169,6 +1195,41 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
1169
1195
  async clearBrowsingLocation() {
1170
1196
  return this.delete("/api/user/browsing-location");
1171
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
+ }
1172
1233
  };
1173
1234
 
1174
1235
  // lib/ecommerce/client/merchant.ts