@betterstore/sdk 0.5.11 → 0.5.13
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/index.d.mts +12 -10
- package/dist/index.d.ts +12 -10
- package/dist/index.js +12 -5
- package/dist/index.mjs +12 -5
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -93,8 +93,12 @@ interface CheckoutSession {
|
|
|
93
93
|
type AutosuggestAddressResult = {
|
|
94
94
|
id: string;
|
|
95
95
|
title: string;
|
|
96
|
+
position: {
|
|
97
|
+
lat: number;
|
|
98
|
+
lng: number;
|
|
99
|
+
};
|
|
96
100
|
};
|
|
97
|
-
type
|
|
101
|
+
type GeocodeAddressResult = Omit<AutosuggestAddressResult, "position"> & Pick<Address, "line1" | "line2" | "city" | "province" | "provinceCode" | "country" | "countryCode" | "zipCode">;
|
|
98
102
|
|
|
99
103
|
type SortOrder = "asc" | "desc";
|
|
100
104
|
type GetListParams<A, B> = {
|
|
@@ -514,15 +518,13 @@ declare class Client {
|
|
|
514
518
|
countryCode?: string;
|
|
515
519
|
}): Promise<AutosuggestAddressResult[]>;
|
|
516
520
|
/**
|
|
517
|
-
* Get
|
|
521
|
+
* Get geocode address results
|
|
518
522
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
countryCode?: string;
|
|
525
|
-
}): Promise<LookupAddressResult[]>;
|
|
523
|
+
getGeocodeAddressResults(clientSecret: string, params: {
|
|
524
|
+
id: string;
|
|
525
|
+
title: string;
|
|
526
|
+
position: AutosuggestAddressResult["position"];
|
|
527
|
+
}): Promise<GeocodeAddressResult[]>;
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
declare class Collections {
|
|
@@ -596,4 +598,4 @@ declare function createStoreHelpers(config?: {
|
|
|
596
598
|
proxy?: string;
|
|
597
599
|
}): Helpers;
|
|
598
600
|
|
|
599
|
-
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type
|
|
601
|
+
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type GeocodeAddressResult, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -93,8 +93,12 @@ interface CheckoutSession {
|
|
|
93
93
|
type AutosuggestAddressResult = {
|
|
94
94
|
id: string;
|
|
95
95
|
title: string;
|
|
96
|
+
position: {
|
|
97
|
+
lat: number;
|
|
98
|
+
lng: number;
|
|
99
|
+
};
|
|
96
100
|
};
|
|
97
|
-
type
|
|
101
|
+
type GeocodeAddressResult = Omit<AutosuggestAddressResult, "position"> & Pick<Address, "line1" | "line2" | "city" | "province" | "provinceCode" | "country" | "countryCode" | "zipCode">;
|
|
98
102
|
|
|
99
103
|
type SortOrder = "asc" | "desc";
|
|
100
104
|
type GetListParams<A, B> = {
|
|
@@ -514,15 +518,13 @@ declare class Client {
|
|
|
514
518
|
countryCode?: string;
|
|
515
519
|
}): Promise<AutosuggestAddressResult[]>;
|
|
516
520
|
/**
|
|
517
|
-
* Get
|
|
521
|
+
* Get geocode address results
|
|
518
522
|
*/
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
countryCode?: string;
|
|
525
|
-
}): Promise<LookupAddressResult[]>;
|
|
523
|
+
getGeocodeAddressResults(clientSecret: string, params: {
|
|
524
|
+
id: string;
|
|
525
|
+
title: string;
|
|
526
|
+
position: AutosuggestAddressResult["position"];
|
|
527
|
+
}): Promise<GeocodeAddressResult[]>;
|
|
526
528
|
}
|
|
527
529
|
|
|
528
530
|
declare class Collections {
|
|
@@ -596,4 +598,4 @@ declare function createStoreHelpers(config?: {
|
|
|
596
598
|
proxy?: string;
|
|
597
599
|
}): Helpers;
|
|
598
600
|
|
|
599
|
-
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type
|
|
601
|
+
export { type Address, type AutosuggestAddressResult, type CheckoutCreateParams, type CheckoutSession, type CheckoutUpdateParams, type Collection, type CollectionWithProducts, type Currency, type Customer$1 as Customer, type CustomerCreateParams, type CustomerSession, type CustomerSubscription, type CustomerSubscriptionUpdateParams, type CustomerUpdateParams, type Discount, type GeocodeAddressResult, type LineItem, type LineItemCreate, type ListCollectionsParams, type ListCollectionsQuery, type ListCollectionsSortBy, type ListDiscountsParams, type ListDiscountsQuery, type ListDiscountsSortBy, type ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, type OTPVerifyParams, type OTPVerifyResponse, type Product, type ProductBillingInterval, type ProductBillingType, type ProductOption, type ProductStatus, type ProductVariant, type ProductWithoutVariants, type RetrieveCollectionParams, type RetrieveDiscountParams, type RetrieveProductParams, type ShippingRate, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
|
package/dist/index.js
CHANGED
|
@@ -401,7 +401,9 @@ var Client = class {
|
|
|
401
401
|
*/
|
|
402
402
|
async getExchangeRate(clientSecret, baseCurrency, targetCurrency) {
|
|
403
403
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
404
|
-
const
|
|
404
|
+
const data = await apiClient.get(
|
|
405
|
+
`/helpers/rates/${baseCurrency}`
|
|
406
|
+
);
|
|
405
407
|
const rate = data.rates[targetCurrency];
|
|
406
408
|
if (!rate) {
|
|
407
409
|
throw new Error("Could not get exchange rate for target currency");
|
|
@@ -419,12 +421,17 @@ var Client = class {
|
|
|
419
421
|
return data;
|
|
420
422
|
}
|
|
421
423
|
/**
|
|
422
|
-
* Get
|
|
424
|
+
* Get geocode address results
|
|
423
425
|
*/
|
|
424
|
-
async
|
|
426
|
+
async getGeocodeAddressResults(clientSecret, params) {
|
|
425
427
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
426
|
-
const {
|
|
427
|
-
|
|
428
|
+
const { position, ...rest } = params;
|
|
429
|
+
const { data } = await apiClient.get("/helpers/geocode-address", {
|
|
430
|
+
params: {
|
|
431
|
+
...rest,
|
|
432
|
+
lat: position.lat,
|
|
433
|
+
lng: position.lng
|
|
434
|
+
}
|
|
428
435
|
});
|
|
429
436
|
return data;
|
|
430
437
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -363,7 +363,9 @@ var Client = class {
|
|
|
363
363
|
*/
|
|
364
364
|
async getExchangeRate(clientSecret, baseCurrency, targetCurrency) {
|
|
365
365
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
366
|
-
const
|
|
366
|
+
const data = await apiClient.get(
|
|
367
|
+
`/helpers/rates/${baseCurrency}`
|
|
368
|
+
);
|
|
367
369
|
const rate = data.rates[targetCurrency];
|
|
368
370
|
if (!rate) {
|
|
369
371
|
throw new Error("Could not get exchange rate for target currency");
|
|
@@ -381,12 +383,17 @@ var Client = class {
|
|
|
381
383
|
return data;
|
|
382
384
|
}
|
|
383
385
|
/**
|
|
384
|
-
* Get
|
|
386
|
+
* Get geocode address results
|
|
385
387
|
*/
|
|
386
|
-
async
|
|
388
|
+
async getGeocodeAddressResults(clientSecret, params) {
|
|
387
389
|
const apiClient = createApiClient(clientSecret, this.proxy);
|
|
388
|
-
const {
|
|
389
|
-
|
|
390
|
+
const { position, ...rest } = params;
|
|
391
|
+
const { data } = await apiClient.get("/helpers/geocode-address", {
|
|
392
|
+
params: {
|
|
393
|
+
...rest,
|
|
394
|
+
lat: position.lat,
|
|
395
|
+
lng: position.lng
|
|
396
|
+
}
|
|
390
397
|
});
|
|
391
398
|
return data;
|
|
392
399
|
}
|