@basedone/core 0.2.3 → 0.2.4
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-SKX4VGEN.mjs → chunk-NVL2HX2H.mjs} +143 -0
- package/dist/ecommerce.d.mts +308 -2
- package/dist/ecommerce.d.ts +308 -2
- package/dist/ecommerce.js +143 -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 +143 -0
- package/dist/index.mjs +1 -1
- package/lib/ecommerce/client/customer.ts +159 -0
- package/lib/ecommerce/types/enums.ts +2 -0
- package/lib/ecommerce/types/requests.ts +53 -0
- package/lib/ecommerce/types/responses.ts +166 -0
- package/package.json +1 -1
|
@@ -988,6 +988,148 @@ var CustomerEcommerceClient = class extends BaseEcommerceClient {
|
|
|
988
988
|
async getPaymentMethods() {
|
|
989
989
|
return this.get("/api/marketplace/payments/methods");
|
|
990
990
|
}
|
|
991
|
+
// ============================================================================
|
|
992
|
+
// GEM System API
|
|
993
|
+
// ============================================================================
|
|
994
|
+
/**
|
|
995
|
+
* Get user's gem balance
|
|
996
|
+
*
|
|
997
|
+
* Returns the current gem balance including total gems, available gems,
|
|
998
|
+
* and gems expiring soon. Gems are earned at 100 per $1 of revenue.
|
|
999
|
+
*
|
|
1000
|
+
* @returns Current gem balance with USD equivalent
|
|
1001
|
+
*
|
|
1002
|
+
* @example
|
|
1003
|
+
* ```typescript
|
|
1004
|
+
* const balance = await client.getGemBalance();
|
|
1005
|
+
* console.log(`You have ${balance.totalGems} gems (${balance.usdEquivalent} USD)`);
|
|
1006
|
+
* console.log(`${balance.expiringSoon} gems expiring soon`);
|
|
1007
|
+
* ```
|
|
1008
|
+
*/
|
|
1009
|
+
async getGemBalance() {
|
|
1010
|
+
return this.get("/api/gems/balance");
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Get gem transaction history
|
|
1014
|
+
*
|
|
1015
|
+
* Returns paginated history of gem transactions including earning,
|
|
1016
|
+
* spending, and expiration events.
|
|
1017
|
+
*
|
|
1018
|
+
* @param params - Query parameters for filtering and pagination
|
|
1019
|
+
* @returns Paginated gem history
|
|
1020
|
+
*
|
|
1021
|
+
* @example
|
|
1022
|
+
* ```typescript
|
|
1023
|
+
* // Get all history
|
|
1024
|
+
* const history = await client.getGemHistory({ limit: 20, offset: 0 });
|
|
1025
|
+
*
|
|
1026
|
+
* // Get only earned gems
|
|
1027
|
+
* const earned = await client.getGemHistory({ type: "earn", limit: 10 });
|
|
1028
|
+
*
|
|
1029
|
+
* // Get only spent gems
|
|
1030
|
+
* const spent = await client.getGemHistory({ type: "spend", limit: 10 });
|
|
1031
|
+
*
|
|
1032
|
+
* history.items.forEach(item => {
|
|
1033
|
+
* console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
|
|
1034
|
+
* });
|
|
1035
|
+
* ```
|
|
1036
|
+
*/
|
|
1037
|
+
async getGemHistory(params) {
|
|
1038
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
1039
|
+
return this.get(`/api/gems/history${queryString}`);
|
|
1040
|
+
}
|
|
1041
|
+
/**
|
|
1042
|
+
* Get gems that are expiring soon
|
|
1043
|
+
*
|
|
1044
|
+
* Returns gem batches that will expire within the specified number of days.
|
|
1045
|
+
* Useful for prompting users to spend gems before they expire.
|
|
1046
|
+
*
|
|
1047
|
+
* @param params - Query parameters (days: default 30, max 180)
|
|
1048
|
+
* @returns Expiring gem batches with countdown info
|
|
1049
|
+
*
|
|
1050
|
+
* @example
|
|
1051
|
+
* ```typescript
|
|
1052
|
+
* // Get gems expiring in next 30 days (default)
|
|
1053
|
+
* const expiring = await client.getExpiringGems();
|
|
1054
|
+
*
|
|
1055
|
+
* // Get gems expiring in next 7 days
|
|
1056
|
+
* const urgent = await client.getExpiringGems({ days: 7 });
|
|
1057
|
+
*
|
|
1058
|
+
* if (expiring.totalExpiring > 0) {
|
|
1059
|
+
* console.log(`${expiring.totalExpiring} gems expiring soon!`);
|
|
1060
|
+
* expiring.batches.forEach(batch => {
|
|
1061
|
+
* console.log(`${batch.amount} gems expire in ${batch.daysUntilExpiry} days`);
|
|
1062
|
+
* });
|
|
1063
|
+
* }
|
|
1064
|
+
* ```
|
|
1065
|
+
*/
|
|
1066
|
+
async getExpiringGems(params) {
|
|
1067
|
+
const queryString = params ? buildQueryString(params) : "";
|
|
1068
|
+
return this.get(`/api/gems/expiring${queryString}`);
|
|
1069
|
+
}
|
|
1070
|
+
// ============================================================================
|
|
1071
|
+
// Browsing Location API
|
|
1072
|
+
// ============================================================================
|
|
1073
|
+
/**
|
|
1074
|
+
* Get user's browsing location
|
|
1075
|
+
*
|
|
1076
|
+
* Returns the user's saved delivery location for geo-based product filtering.
|
|
1077
|
+
* This location is used to show products from merchants that ship to the area.
|
|
1078
|
+
*
|
|
1079
|
+
* @returns Current browsing location or null if not set
|
|
1080
|
+
*
|
|
1081
|
+
* @example
|
|
1082
|
+
* ```typescript
|
|
1083
|
+
* const result = await client.getBrowsingLocation();
|
|
1084
|
+
* if (result.location) {
|
|
1085
|
+
* console.log(`Delivery to: ${result.location.city}, ${result.location.country}`);
|
|
1086
|
+
* }
|
|
1087
|
+
* ```
|
|
1088
|
+
*/
|
|
1089
|
+
async getBrowsingLocation() {
|
|
1090
|
+
return this.get("/api/user/browsing-location");
|
|
1091
|
+
}
|
|
1092
|
+
/**
|
|
1093
|
+
* Save user's browsing location
|
|
1094
|
+
*
|
|
1095
|
+
* Sets the user's delivery location for geo-based product filtering.
|
|
1096
|
+
* Products will be filtered to show only items from merchants that ship to this location.
|
|
1097
|
+
*
|
|
1098
|
+
* @param request - Location data from Google Places or manual input
|
|
1099
|
+
* @returns The saved location
|
|
1100
|
+
*
|
|
1101
|
+
* @example
|
|
1102
|
+
* ```typescript
|
|
1103
|
+
* const result = await client.saveBrowsingLocation({
|
|
1104
|
+
* formattedAddress: "Singapore, Singapore",
|
|
1105
|
+
* city: "Singapore",
|
|
1106
|
+
* country: "SG",
|
|
1107
|
+
* latitude: 1.3521,
|
|
1108
|
+
* longitude: 103.8198
|
|
1109
|
+
* });
|
|
1110
|
+
* console.log(`Location saved: ${result.location.formattedAddress}`);
|
|
1111
|
+
* ```
|
|
1112
|
+
*/
|
|
1113
|
+
async saveBrowsingLocation(request) {
|
|
1114
|
+
return this.post("/api/user/browsing-location", request);
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Clear user's browsing location
|
|
1118
|
+
*
|
|
1119
|
+
* Removes the user's saved delivery location. Products will no longer
|
|
1120
|
+
* be filtered by shipping destination.
|
|
1121
|
+
*
|
|
1122
|
+
* @returns Success response
|
|
1123
|
+
*
|
|
1124
|
+
* @example
|
|
1125
|
+
* ```typescript
|
|
1126
|
+
* await client.clearBrowsingLocation();
|
|
1127
|
+
* console.log("Location cleared - showing all products");
|
|
1128
|
+
* ```
|
|
1129
|
+
*/
|
|
1130
|
+
async clearBrowsingLocation() {
|
|
1131
|
+
return this.delete("/api/user/browsing-location");
|
|
1132
|
+
}
|
|
991
1133
|
};
|
|
992
1134
|
|
|
993
1135
|
// lib/ecommerce/client/merchant.ts
|
|
@@ -2651,6 +2793,7 @@ var ProductSortBy = /* @__PURE__ */ ((ProductSortBy2) => {
|
|
|
2651
2793
|
ProductSortBy2["PRICE_DESC"] = "price_desc";
|
|
2652
2794
|
ProductSortBy2["POPULAR"] = "popular";
|
|
2653
2795
|
ProductSortBy2["FEATURED"] = "featured";
|
|
2796
|
+
ProductSortBy2["NEARBY"] = "nearby";
|
|
2654
2797
|
return ProductSortBy2;
|
|
2655
2798
|
})(ProductSortBy || {});
|
|
2656
2799
|
var ReviewSortBy = /* @__PURE__ */ ((ReviewSortBy2) => {
|
package/dist/ecommerce.d.mts
CHANGED
|
@@ -410,7 +410,9 @@ declare enum ProductSortBy {
|
|
|
410
410
|
/** Sort by popularity */
|
|
411
411
|
POPULAR = "popular",
|
|
412
412
|
/** Sort by featured status */
|
|
413
|
-
FEATURED = "featured"
|
|
413
|
+
FEATURED = "featured",
|
|
414
|
+
/** Sort by proximity to user location (requires lat/lng) */
|
|
415
|
+
NEARBY = "nearby"
|
|
414
416
|
}
|
|
415
417
|
/**
|
|
416
418
|
* Review sort by enum
|
|
@@ -1292,6 +1294,12 @@ interface ListProductsParams extends PaginationParams {
|
|
|
1292
1294
|
sortBy?: ProductSortBy;
|
|
1293
1295
|
/** Filter by active status */
|
|
1294
1296
|
isActive?: boolean;
|
|
1297
|
+
/** Filter by destination country (ISO 2-letter code) - only show products from merchants that ship here */
|
|
1298
|
+
country?: string;
|
|
1299
|
+
/** User latitude for proximity sorting (used with sortBy=nearby) */
|
|
1300
|
+
lat?: number;
|
|
1301
|
+
/** User longitude for proximity sorting (used with sortBy=nearby) */
|
|
1302
|
+
lng?: number;
|
|
1295
1303
|
}
|
|
1296
1304
|
/**
|
|
1297
1305
|
* Create product request
|
|
@@ -1893,6 +1901,41 @@ interface CalculateShippingRequest {
|
|
|
1893
1901
|
/** Order subtotal in USDC */
|
|
1894
1902
|
orderSubtotal: number;
|
|
1895
1903
|
}
|
|
1904
|
+
/**
|
|
1905
|
+
* Gem history type filter
|
|
1906
|
+
*/
|
|
1907
|
+
type GemHistoryTypeFilter = "earn" | "spend" | "all";
|
|
1908
|
+
/**
|
|
1909
|
+
* Get gem history parameters
|
|
1910
|
+
*/
|
|
1911
|
+
interface GetGemHistoryParams extends PaginationParams {
|
|
1912
|
+
/** Filter by transaction type */
|
|
1913
|
+
type?: GemHistoryTypeFilter;
|
|
1914
|
+
}
|
|
1915
|
+
/**
|
|
1916
|
+
* Get expiring gems parameters
|
|
1917
|
+
*/
|
|
1918
|
+
interface GetExpiringGemsParams {
|
|
1919
|
+
/** Number of days ahead to check (default: 30, max: 180) */
|
|
1920
|
+
days?: number;
|
|
1921
|
+
}
|
|
1922
|
+
/**
|
|
1923
|
+
* Save browsing location request
|
|
1924
|
+
*/
|
|
1925
|
+
interface SaveBrowsingLocationRequest {
|
|
1926
|
+
/** Full display address from Google Places */
|
|
1927
|
+
formattedAddress: string;
|
|
1928
|
+
/** City name */
|
|
1929
|
+
city: string;
|
|
1930
|
+
/** State/Province (optional) */
|
|
1931
|
+
stateProvince?: string;
|
|
1932
|
+
/** ISO 2-letter country code (e.g., "SG", "US") */
|
|
1933
|
+
country: string;
|
|
1934
|
+
/** Latitude coordinate */
|
|
1935
|
+
latitude: number;
|
|
1936
|
+
/** Longitude coordinate */
|
|
1937
|
+
longitude: number;
|
|
1938
|
+
}
|
|
1896
1939
|
|
|
1897
1940
|
/**
|
|
1898
1941
|
* Ecommerce API Response Types
|
|
@@ -2882,6 +2925,147 @@ interface ProcessPaymentResponse {
|
|
|
2882
2925
|
/** Error code */
|
|
2883
2926
|
errorCode?: string;
|
|
2884
2927
|
}
|
|
2928
|
+
/**
|
|
2929
|
+
* Gem source type - how gems were earned
|
|
2930
|
+
*/
|
|
2931
|
+
type GemSource = "BUILDER_CODE" | "PREDICTION" | "CARD_SPEND" | "MALL_SPEND" | "ADMIN" | "REFUND";
|
|
2932
|
+
/**
|
|
2933
|
+
* Get gem balance response
|
|
2934
|
+
*/
|
|
2935
|
+
interface GetGemBalanceResponse {
|
|
2936
|
+
/** User ID */
|
|
2937
|
+
userId: string;
|
|
2938
|
+
/** Total gems owned */
|
|
2939
|
+
totalGems: number;
|
|
2940
|
+
/** Available gems (not reserved) */
|
|
2941
|
+
availableGems: number;
|
|
2942
|
+
/** Gems expiring within 30 days */
|
|
2943
|
+
expiringSoon: number;
|
|
2944
|
+
/** Last balance update timestamp */
|
|
2945
|
+
lastUpdated: string;
|
|
2946
|
+
/** USD equivalent (totalGems / 100) */
|
|
2947
|
+
usdEquivalent: number;
|
|
2948
|
+
/** Conversion rate (gems per $1) */
|
|
2949
|
+
conversionRate: number;
|
|
2950
|
+
}
|
|
2951
|
+
/**
|
|
2952
|
+
* Gem history item type
|
|
2953
|
+
*/
|
|
2954
|
+
type GemHistoryType = "earn" | "spend" | "expire";
|
|
2955
|
+
/**
|
|
2956
|
+
* Gem history item
|
|
2957
|
+
*/
|
|
2958
|
+
interface GemHistoryItem {
|
|
2959
|
+
/** Transaction ID */
|
|
2960
|
+
id: string;
|
|
2961
|
+
/** Type of transaction */
|
|
2962
|
+
type: GemHistoryType;
|
|
2963
|
+
/** Amount of gems (positive for earn, negative for spend) */
|
|
2964
|
+
amount: number;
|
|
2965
|
+
/** Source type (for earn transactions) */
|
|
2966
|
+
source?: GemSource;
|
|
2967
|
+
/** Reason description (for spend transactions) */
|
|
2968
|
+
reason?: string;
|
|
2969
|
+
/** When the transaction occurred */
|
|
2970
|
+
createdAt: string;
|
|
2971
|
+
/** When the gems expire (for earn transactions) */
|
|
2972
|
+
expiresAt?: string;
|
|
2973
|
+
}
|
|
2974
|
+
/**
|
|
2975
|
+
* Get gem history response
|
|
2976
|
+
*/
|
|
2977
|
+
interface GetGemHistoryResponse {
|
|
2978
|
+
/** History items */
|
|
2979
|
+
items: GemHistoryItem[];
|
|
2980
|
+
/** Total count of items */
|
|
2981
|
+
total: number;
|
|
2982
|
+
/** Pagination info */
|
|
2983
|
+
pagination: {
|
|
2984
|
+
/** Items per page */
|
|
2985
|
+
limit: number;
|
|
2986
|
+
/** Current offset */
|
|
2987
|
+
offset: number;
|
|
2988
|
+
/** Whether more items exist */
|
|
2989
|
+
hasMore: boolean;
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
/**
|
|
2993
|
+
* Expiring gem batch
|
|
2994
|
+
*/
|
|
2995
|
+
interface ExpiringGemBatch {
|
|
2996
|
+
/** Batch ID */
|
|
2997
|
+
id: string;
|
|
2998
|
+
/** Remaining gems in batch */
|
|
2999
|
+
amount: number;
|
|
3000
|
+
/** How the gems were earned */
|
|
3001
|
+
source: GemSource;
|
|
3002
|
+
/** When the batch expires */
|
|
3003
|
+
expiresAt: string;
|
|
3004
|
+
/** When the batch was created */
|
|
3005
|
+
createdAt: string;
|
|
3006
|
+
/** Days until expiry */
|
|
3007
|
+
daysUntilExpiry: number;
|
|
3008
|
+
}
|
|
3009
|
+
/**
|
|
3010
|
+
* Get expiring gems response
|
|
3011
|
+
*/
|
|
3012
|
+
interface GetExpiringGemsResponse {
|
|
3013
|
+
/** Total gems expiring within the query period */
|
|
3014
|
+
totalExpiring: number;
|
|
3015
|
+
/** Expiring batches */
|
|
3016
|
+
batches: ExpiringGemBatch[];
|
|
3017
|
+
/** Query parameters used */
|
|
3018
|
+
queryParams: {
|
|
3019
|
+
/** Days ahead that were queried */
|
|
3020
|
+
days: number;
|
|
3021
|
+
};
|
|
3022
|
+
}
|
|
3023
|
+
/**
|
|
3024
|
+
* User's browsing location for geo-based product filtering
|
|
3025
|
+
*/
|
|
3026
|
+
interface BrowsingLocation {
|
|
3027
|
+
/** Location ID */
|
|
3028
|
+
id: string;
|
|
3029
|
+
/** Full display address */
|
|
3030
|
+
formattedAddress: string;
|
|
3031
|
+
/** City name */
|
|
3032
|
+
city: string;
|
|
3033
|
+
/** State/Province (if applicable) */
|
|
3034
|
+
stateProvince?: string | null;
|
|
3035
|
+
/** ISO 2-letter country code */
|
|
3036
|
+
country: string;
|
|
3037
|
+
/** Latitude coordinate */
|
|
3038
|
+
latitude: number;
|
|
3039
|
+
/** Longitude coordinate */
|
|
3040
|
+
longitude: number;
|
|
3041
|
+
/** Last updated timestamp */
|
|
3042
|
+
updatedAt: string;
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Get browsing location response
|
|
3046
|
+
*/
|
|
3047
|
+
interface GetBrowsingLocationResponse {
|
|
3048
|
+
/** User's saved browsing location (null if not set) */
|
|
3049
|
+
location: BrowsingLocation | null;
|
|
3050
|
+
}
|
|
3051
|
+
/**
|
|
3052
|
+
* Save browsing location response
|
|
3053
|
+
*/
|
|
3054
|
+
interface SaveBrowsingLocationResponse {
|
|
3055
|
+
/** Whether the operation was successful */
|
|
3056
|
+
success: boolean;
|
|
3057
|
+
/** The saved location */
|
|
3058
|
+
location: BrowsingLocation;
|
|
3059
|
+
}
|
|
3060
|
+
/**
|
|
3061
|
+
* Delete browsing location response
|
|
3062
|
+
*/
|
|
3063
|
+
interface DeleteBrowsingLocationResponse {
|
|
3064
|
+
/** Whether the operation was successful */
|
|
3065
|
+
success: boolean;
|
|
3066
|
+
/** Success message */
|
|
3067
|
+
message: string;
|
|
3068
|
+
}
|
|
2885
3069
|
|
|
2886
3070
|
/**
|
|
2887
3071
|
* Customer/End-User Ecommerce API Client
|
|
@@ -3482,6 +3666,128 @@ declare class CustomerEcommerceClient extends BaseEcommerceClient {
|
|
|
3482
3666
|
* ```
|
|
3483
3667
|
*/
|
|
3484
3668
|
getPaymentMethods(): Promise<GetPaymentMethodsResponse>;
|
|
3669
|
+
/**
|
|
3670
|
+
* Get user's gem balance
|
|
3671
|
+
*
|
|
3672
|
+
* Returns the current gem balance including total gems, available gems,
|
|
3673
|
+
* and gems expiring soon. Gems are earned at 100 per $1 of revenue.
|
|
3674
|
+
*
|
|
3675
|
+
* @returns Current gem balance with USD equivalent
|
|
3676
|
+
*
|
|
3677
|
+
* @example
|
|
3678
|
+
* ```typescript
|
|
3679
|
+
* const balance = await client.getGemBalance();
|
|
3680
|
+
* console.log(`You have ${balance.totalGems} gems (${balance.usdEquivalent} USD)`);
|
|
3681
|
+
* console.log(`${balance.expiringSoon} gems expiring soon`);
|
|
3682
|
+
* ```
|
|
3683
|
+
*/
|
|
3684
|
+
getGemBalance(): Promise<GetGemBalanceResponse>;
|
|
3685
|
+
/**
|
|
3686
|
+
* Get gem transaction history
|
|
3687
|
+
*
|
|
3688
|
+
* Returns paginated history of gem transactions including earning,
|
|
3689
|
+
* spending, and expiration events.
|
|
3690
|
+
*
|
|
3691
|
+
* @param params - Query parameters for filtering and pagination
|
|
3692
|
+
* @returns Paginated gem history
|
|
3693
|
+
*
|
|
3694
|
+
* @example
|
|
3695
|
+
* ```typescript
|
|
3696
|
+
* // Get all history
|
|
3697
|
+
* const history = await client.getGemHistory({ limit: 20, offset: 0 });
|
|
3698
|
+
*
|
|
3699
|
+
* // Get only earned gems
|
|
3700
|
+
* const earned = await client.getGemHistory({ type: "earn", limit: 10 });
|
|
3701
|
+
*
|
|
3702
|
+
* // Get only spent gems
|
|
3703
|
+
* const spent = await client.getGemHistory({ type: "spend", limit: 10 });
|
|
3704
|
+
*
|
|
3705
|
+
* history.items.forEach(item => {
|
|
3706
|
+
* console.log(`${item.type}: ${item.amount} gems - ${item.createdAt}`);
|
|
3707
|
+
* });
|
|
3708
|
+
* ```
|
|
3709
|
+
*/
|
|
3710
|
+
getGemHistory(params?: GetGemHistoryParams): Promise<GetGemHistoryResponse>;
|
|
3711
|
+
/**
|
|
3712
|
+
* Get gems that are expiring soon
|
|
3713
|
+
*
|
|
3714
|
+
* Returns gem batches that will expire within the specified number of days.
|
|
3715
|
+
* Useful for prompting users to spend gems before they expire.
|
|
3716
|
+
*
|
|
3717
|
+
* @param params - Query parameters (days: default 30, max 180)
|
|
3718
|
+
* @returns Expiring gem batches with countdown info
|
|
3719
|
+
*
|
|
3720
|
+
* @example
|
|
3721
|
+
* ```typescript
|
|
3722
|
+
* // Get gems expiring in next 30 days (default)
|
|
3723
|
+
* const expiring = await client.getExpiringGems();
|
|
3724
|
+
*
|
|
3725
|
+
* // Get gems expiring in next 7 days
|
|
3726
|
+
* const urgent = await client.getExpiringGems({ days: 7 });
|
|
3727
|
+
*
|
|
3728
|
+
* if (expiring.totalExpiring > 0) {
|
|
3729
|
+
* console.log(`${expiring.totalExpiring} gems expiring soon!`);
|
|
3730
|
+
* expiring.batches.forEach(batch => {
|
|
3731
|
+
* console.log(`${batch.amount} gems expire in ${batch.daysUntilExpiry} days`);
|
|
3732
|
+
* });
|
|
3733
|
+
* }
|
|
3734
|
+
* ```
|
|
3735
|
+
*/
|
|
3736
|
+
getExpiringGems(params?: GetExpiringGemsParams): Promise<GetExpiringGemsResponse>;
|
|
3737
|
+
/**
|
|
3738
|
+
* Get user's browsing location
|
|
3739
|
+
*
|
|
3740
|
+
* Returns the user's saved delivery location for geo-based product filtering.
|
|
3741
|
+
* This location is used to show products from merchants that ship to the area.
|
|
3742
|
+
*
|
|
3743
|
+
* @returns Current browsing location or null if not set
|
|
3744
|
+
*
|
|
3745
|
+
* @example
|
|
3746
|
+
* ```typescript
|
|
3747
|
+
* const result = await client.getBrowsingLocation();
|
|
3748
|
+
* if (result.location) {
|
|
3749
|
+
* console.log(`Delivery to: ${result.location.city}, ${result.location.country}`);
|
|
3750
|
+
* }
|
|
3751
|
+
* ```
|
|
3752
|
+
*/
|
|
3753
|
+
getBrowsingLocation(): Promise<GetBrowsingLocationResponse>;
|
|
3754
|
+
/**
|
|
3755
|
+
* Save user's browsing location
|
|
3756
|
+
*
|
|
3757
|
+
* Sets the user's delivery location for geo-based product filtering.
|
|
3758
|
+
* Products will be filtered to show only items from merchants that ship to this location.
|
|
3759
|
+
*
|
|
3760
|
+
* @param request - Location data from Google Places or manual input
|
|
3761
|
+
* @returns The saved location
|
|
3762
|
+
*
|
|
3763
|
+
* @example
|
|
3764
|
+
* ```typescript
|
|
3765
|
+
* const result = await client.saveBrowsingLocation({
|
|
3766
|
+
* formattedAddress: "Singapore, Singapore",
|
|
3767
|
+
* city: "Singapore",
|
|
3768
|
+
* country: "SG",
|
|
3769
|
+
* latitude: 1.3521,
|
|
3770
|
+
* longitude: 103.8198
|
|
3771
|
+
* });
|
|
3772
|
+
* console.log(`Location saved: ${result.location.formattedAddress}`);
|
|
3773
|
+
* ```
|
|
3774
|
+
*/
|
|
3775
|
+
saveBrowsingLocation(request: SaveBrowsingLocationRequest): Promise<SaveBrowsingLocationResponse>;
|
|
3776
|
+
/**
|
|
3777
|
+
* Clear user's browsing location
|
|
3778
|
+
*
|
|
3779
|
+
* Removes the user's saved delivery location. Products will no longer
|
|
3780
|
+
* be filtered by shipping destination.
|
|
3781
|
+
*
|
|
3782
|
+
* @returns Success response
|
|
3783
|
+
*
|
|
3784
|
+
* @example
|
|
3785
|
+
* ```typescript
|
|
3786
|
+
* await client.clearBrowsingLocation();
|
|
3787
|
+
* console.log("Location cleared - showing all products");
|
|
3788
|
+
* ```
|
|
3789
|
+
*/
|
|
3790
|
+
clearBrowsingLocation(): Promise<DeleteBrowsingLocationResponse>;
|
|
3485
3791
|
}
|
|
3486
3792
|
|
|
3487
3793
|
/**
|
|
@@ -5196,4 +5502,4 @@ declare function calculateDiscountAmount(price: number, discountType: "PERCENTAG
|
|
|
5196
5502
|
*/
|
|
5197
5503
|
declare function calculateFinalPrice(price: number, discountType: "PERCENTAGE" | "FIXED_AMOUNT", discountValue: number): number;
|
|
5198
5504
|
|
|
5199
|
-
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateShippingRequest, type CalculateShippingResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateShippingRateRequest, type CreateShippingZoneRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type FollowActionResponse, type FollowStatusResponse, type FollowedMerchantSummary, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetCouponResponse, type GetOrderResponse, type GetPaymentMethodsResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListFollowingParams, type ListFollowingResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMerchantProductsParams, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListShippingRatesResponse, type ListShippingZonesResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProductsResponse, type MerchantProfileRequest, type MerchantProfileResponse, type MerchantShippingSettings, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, type PaymentMethodInfo, PaymentStatus, type ProcessPaymentRequest, type ProcessPaymentResponse, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type PublicMerchantProfile, type PublicMerchantProfileResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress$1 as ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, type ShippingOption, type ShippingRate, type ShippingRateResponse, type ShippingSettingsResponse, type ShippingZone, type ShippingZoneResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateShippingRateRequest, type UpdateShippingSettingsRequest, type UpdateShippingZoneRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|
|
5505
|
+
export { type ActiveFlashSalesResponse, type AnalyticsOverview, type ApiResponse, type AppliedDiscount, type Banner, type BannerResponse, BannerType, BaseEcommerceClient, type BaseEntity, type BrowsingLocation, type CalculateCartDiscountsRequest, type CalculateCartDiscountsResponse, type CalculateShippingRequest, type CalculateShippingResponse, type CalculateTaxRequest, type CalculateTaxResponse, type CartItem, type ConfirmEscrowDepositResponse, type Coupon, type CouponResponse, type CouponUsage, type CreateBannerRequest, type CreateCouponRequest, type CreateFlashSaleRequest, type CreateOrderEventRequest, type CreateOrderEventResponse, type CreateOrderRequest, type CreateOrderResponse, type CreateProductRequest, type CreateProductVariantRequest, type CreateReviewRequest, type CreateShippingMethodRequest, type CreateShippingRateRequest, type CreateShippingZoneRequest, type CreateTaxNexusRequest, type CreateTaxRuleRequest, CustomerEcommerceClient, type CustomerMessagesResponse, type CustomerSummary, type DeleteBrowsingLocationResponse, DiscountMethod, DiscountScope, DiscountType, EcommerceApiError, type EcommerceClientConfig, type ExpiringGemBatch, type FlashSale, type FlashSaleItem, type FlashSaleItemInput, type FollowActionResponse, type FollowStatusResponse, type FollowedMerchantSummary, type GemHistoryItem, type GemHistoryType, type GemHistoryTypeFilter, type GemSource, type GenerateTaxReportRequest, type GetAnalyticsParams, type GetAnalyticsResponse, type GetBrowsingLocationResponse, type GetCouponResponse, type GetExpiringGemsParams, type GetExpiringGemsResponse, type GetGemBalanceResponse, type GetGemHistoryParams, type GetGemHistoryResponse, type GetOrderResponse, type GetPaymentMethodsResponse, type GetProductMetricsResponse, type GetProductResponse, type GetTaxReportResponse, InventoryAuditAction, type InventoryAuditEntry, type ListActiveBannersParams, type ListActiveFlashSalesParams, type ListBannersResponse, type ListCouponsResponse, type ListCustomersParams, type ListCustomersResponse, type ListFollowingParams, type ListFollowingResponse, type ListInventoryAuditResponse, type ListMediaAssetsResponse, type ListMerchantProductsParams, type ListMessagesResponse, type ListOrdersParams, type ListOrdersResponse, type ListProductVariantsResponse, type ListProductsParams, type ListProductsResponse, type ListReturnsResponse, type ListReviewsParams, type ListReviewsResponse, type ListShipmentsResponse, type ListShippingAddressesResponse, type ListShippingMethodsResponse, type ListShippingRatesResponse, type ListShippingZonesResponse, type ListTaxNexusResponse, type ListTaxReportsParams, type ListTaxReportsResponse, type ListTaxRulesResponse, type MediaAsset, type MediaAssetResponse, type Merchant, MerchantEcommerceClient, type MerchantProductsResponse, type MerchantProfileRequest, type MerchantProfileResponse, type MerchantShippingSettings, MerchantStatus, type Message, type MessageResponse, type MessageStatsResponse, type Order, type OrderEvent, type OrderItem, type OrderReceiptResponse, OrderStatus, type OrdersByStatus, type PaginatedResponse, type PaginationParams, type Payment, PaymentMethod, type PaymentMethodInfo, PaymentStatus, type ProcessPaymentRequest, type ProcessPaymentResponse, type Product, type ProductDimensions, type ProductDiscountsResponse, type ProductMetrics, type ProductResponse, type ProductReview, ProductSortBy, type ProductVariant, type ProductVariantResponse, type PublicMerchantProfile, type PublicMerchantProfileResponse, type RecentOrderSummary, type RespondToReviewRequest, type Return, type ReturnItem, type ReturnResponse, ReturnStatus, type RevenueByDay, type ReviewResponse, ReviewSortBy, ReviewStatus, type SaveBrowsingLocationRequest, type SaveBrowsingLocationResponse, type SendMessageRequest, type Settlement, type Shipment, type ShipmentResponse, ShipmentStatus, type ShippingAddress$1 as ShippingAddress, type ShippingAddressRequest, type ShippingAddressResponse, type ShippingMethod, type ShippingMethodResponse, type ShippingOption, type ShippingRate, type ShippingRateResponse, type ShippingSettingsResponse, type ShippingZone, type ShippingZoneResponse, SortOrder, type SuccessResponse, TaxBehavior, type TaxBreakdownItem, type TaxNexus, type TaxNexusResponse, type TaxReport, type TaxReportDetails, TaxReportPeriodType, type TaxReportResponse, TaxReportStatus, type TaxRule, type TaxRuleResponse, type TaxSettings, type TaxSettingsResponse, TaxType, type TopProduct, type TrackBannerRequest, type UpdateBannerRequest, type UpdateCouponRequest, type UpdateFlashSaleRequest, type UpdateOrderResponse, type UpdateOrderStatusRequest, type UpdateProductRequest, type UpdateProductVariantRequest, type UpdateShipmentRequest, type UpdateShippingMethodRequest, type UpdateShippingRateRequest, type UpdateShippingSettingsRequest, type UpdateShippingZoneRequest, type UpdateTaxNexusRequest, type UpdateTaxReportStatusRequest, type UpdateTaxRuleRequest, type UpdateTaxSettingsRequest, type UserShippingAddress, type ValidateDiscountRequest, type ValidateDiscountResponse, buildQueryString, calculateDiscountAmount, calculateFinalPrice, formatPrice, getBackoffDelay, isRetryableError, isValidAddress, isValidEmail, parseError, retryWithBackoff, sleep, truncateAddress };
|