@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 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 LookupAddressResult = AutosuggestAddressResult & Pick<Address, "line1" | "line2" | "city" | "province" | "provinceCode" | "country" | "countryCode" | "zipCode">;
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 lookup address results
521
+ * Get geocode address results
518
522
  */
519
- getLookupAddressResults(clientSecret: string, params: {
520
- query: string;
521
- locale?: string;
522
- latitude?: string;
523
- longitude?: string;
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 LookupAddressResult, 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 };
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 LookupAddressResult = AutosuggestAddressResult & Pick<Address, "line1" | "line2" | "city" | "province" | "provinceCode" | "country" | "countryCode" | "zipCode">;
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 lookup address results
521
+ * Get geocode address results
518
522
  */
519
- getLookupAddressResults(clientSecret: string, params: {
520
- query: string;
521
- locale?: string;
522
- latitude?: string;
523
- longitude?: string;
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 LookupAddressResult, 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 };
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 { data } = await apiClient.get(`/helpers/rates/${baseCurrency}`);
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 lookup address results
424
+ * Get geocode address results
423
425
  */
424
- async getLookupAddressResults(clientSecret, params) {
426
+ async getGeocodeAddressResults(clientSecret, params) {
425
427
  const apiClient = createApiClient(clientSecret, this.proxy);
426
- const { data } = await apiClient.get("/helpers/lookup-address", {
427
- params
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 { data } = await apiClient.get(`/helpers/rates/${baseCurrency}`);
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 lookup address results
386
+ * Get geocode address results
385
387
  */
386
- async getLookupAddressResults(clientSecret, params) {
388
+ async getGeocodeAddressResults(clientSecret, params) {
387
389
  const apiClient = createApiClient(clientSecret, this.proxy);
388
- const { data } = await apiClient.get("/helpers/lookup-address", {
389
- params
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",