@betterstore/sdk 0.5.11 → 0.5.12

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
+ latitude: number;
98
+ longitude: 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,12 @@ 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
+ selectedStreetId: string;
525
+ position: AutosuggestAddressResult["position"];
526
+ }): Promise<GeocodeAddressResult[]>;
526
527
  }
527
528
 
528
529
  declare class Collections {
@@ -596,4 +597,4 @@ declare function createStoreHelpers(config?: {
596
597
  proxy?: string;
597
598
  }): Helpers;
598
599
 
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 };
600
+ 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
+ latitude: number;
98
+ longitude: 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,12 @@ 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
+ selectedStreetId: string;
525
+ position: AutosuggestAddressResult["position"];
526
+ }): Promise<GeocodeAddressResult[]>;
526
527
  }
527
528
 
528
529
  declare class Collections {
@@ -596,4 +597,4 @@ declare function createStoreHelpers(config?: {
596
597
  proxy?: string;
597
598
  }): Helpers;
598
599
 
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 };
600
+ 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");
@@ -413,19 +415,26 @@ var Client = class {
413
415
  */
414
416
  async getAutosuggestAddressResults(clientSecret, params) {
415
417
  const apiClient = createApiClient(clientSecret, this.proxy);
416
- const { data } = await apiClient.get("/helpers/autosuggest-address", {
417
- params
418
- });
418
+ const { data, ...rest } = await apiClient.get(
419
+ "/helpers/autosuggest-address",
420
+ {
421
+ params
422
+ }
423
+ );
424
+ console.log("autosuggest data", data);
425
+ console.log("autosuggest rest", rest);
419
426
  return data;
420
427
  }
421
428
  /**
422
- * Get lookup address results
429
+ * Get geocode address results
423
430
  */
424
- async getLookupAddressResults(clientSecret, params) {
431
+ async getGeocodeAddressResults(clientSecret, params) {
425
432
  const apiClient = createApiClient(clientSecret, this.proxy);
426
- const { data } = await apiClient.get("/helpers/lookup-address", {
433
+ const { data, ...rest } = await apiClient.get("/helpers/geocode-address", {
427
434
  params
428
435
  });
436
+ console.log("geocode data", data);
437
+ console.log("geocode rest", rest);
429
438
  return data;
430
439
  }
431
440
  };
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");
@@ -375,19 +377,26 @@ var Client = class {
375
377
  */
376
378
  async getAutosuggestAddressResults(clientSecret, params) {
377
379
  const apiClient = createApiClient(clientSecret, this.proxy);
378
- const { data } = await apiClient.get("/helpers/autosuggest-address", {
379
- params
380
- });
380
+ const { data, ...rest } = await apiClient.get(
381
+ "/helpers/autosuggest-address",
382
+ {
383
+ params
384
+ }
385
+ );
386
+ console.log("autosuggest data", data);
387
+ console.log("autosuggest rest", rest);
381
388
  return data;
382
389
  }
383
390
  /**
384
- * Get lookup address results
391
+ * Get geocode address results
385
392
  */
386
- async getLookupAddressResults(clientSecret, params) {
393
+ async getGeocodeAddressResults(clientSecret, params) {
387
394
  const apiClient = createApiClient(clientSecret, this.proxy);
388
- const { data } = await apiClient.get("/helpers/lookup-address", {
395
+ const { data, ...rest } = await apiClient.get("/helpers/geocode-address", {
389
396
  params
390
397
  });
398
+ console.log("geocode data", data);
399
+ console.log("geocode rest", rest);
391
400
  return data;
392
401
  }
393
402
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.5.11",
3
+ "version": "0.5.12",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",