@betterstore/sdk 0.3.81 → 0.3.83

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @betterstore/sdk
2
2
 
3
+ ## 0.3.83
4
+
5
+ ### Patch Changes
6
+
7
+ - bug fixes
8
+
9
+ ## 0.3.82
10
+
11
+ ### Patch Changes
12
+
13
+ - bug fixes
14
+
3
15
  ## 0.3.81
4
16
 
5
17
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as axios from 'axios';
2
2
 
3
- declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
3
+ declare const createApiClient: (apiKey: string, proxy?: string, returnError?: boolean) => axios.AxiosInstance;
4
4
 
5
5
  type ShippingRate = ZasilkovnaRate;
6
6
  interface BaseRate {
@@ -303,6 +303,10 @@ interface OTPSignupParams extends OTPLoginParams {
303
303
  firstName: string;
304
304
  lastName: string;
305
305
  }
306
+ interface OTPVerifyParams {
307
+ token: string;
308
+ otp: string;
309
+ }
306
310
  type OTPLoginResponse = {
307
311
  success: true;
308
312
  token: string;
@@ -333,7 +337,7 @@ declare class OTP {
333
337
  constructor(apiClient: ReturnType<typeof createApiClient>);
334
338
  signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
335
339
  login(params: OTPLoginParams): Promise<OTPLoginResponse>;
336
- verify(token: string): Promise<OTPVerifyResponse>;
340
+ verify(params: OTPVerifyParams): Promise<OTPVerifyResponse>;
337
341
  }
338
342
 
339
343
  declare class Auth {
@@ -505,4 +509,4 @@ declare function createStoreHelpers(config?: {
505
509
  proxy?: string;
506
510
  }): Helpers;
507
511
 
508
- export { type Address, 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 ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, 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 SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
512
+ export { type Address, 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 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 SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as axios from 'axios';
2
2
 
3
- declare const createApiClient: (apiKey: string, proxy?: string) => axios.AxiosInstance;
3
+ declare const createApiClient: (apiKey: string, proxy?: string, returnError?: boolean) => axios.AxiosInstance;
4
4
 
5
5
  type ShippingRate = ZasilkovnaRate;
6
6
  interface BaseRate {
@@ -303,6 +303,10 @@ interface OTPSignupParams extends OTPLoginParams {
303
303
  firstName: string;
304
304
  lastName: string;
305
305
  }
306
+ interface OTPVerifyParams {
307
+ token: string;
308
+ otp: string;
309
+ }
306
310
  type OTPLoginResponse = {
307
311
  success: true;
308
312
  token: string;
@@ -333,7 +337,7 @@ declare class OTP {
333
337
  constructor(apiClient: ReturnType<typeof createApiClient>);
334
338
  signup(params: OTPSignupParams): Promise<OTPSignupResponse>;
335
339
  login(params: OTPLoginParams): Promise<OTPLoginResponse>;
336
- verify(token: string): Promise<OTPVerifyResponse>;
340
+ verify(params: OTPVerifyParams): Promise<OTPVerifyResponse>;
337
341
  }
338
342
 
339
343
  declare class Auth {
@@ -505,4 +509,4 @@ declare function createStoreHelpers(config?: {
505
509
  proxy?: string;
506
510
  }): Helpers;
507
511
 
508
- export { type Address, 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 ListProductsParams, type ListProductsQuery, type ListProductsSortBy, type OTPLoginParams, type OTPLoginResponse, type OTPSignupParams, type OTPSignupResponse, 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 SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
512
+ export { type Address, 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 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 SortOrder, type VariantOption, createStoreClient, createStoreHelpers, createBetterStore as default };
package/dist/index.js CHANGED
@@ -59,7 +59,7 @@ module.exports = __toCommonJS(index_exports);
59
59
  // src/utils/axios.ts
60
60
  var import_axios = __toESM(require("axios"));
61
61
  var API_BASE_URL = "https://api.betterstore.io/v1";
62
- var createApiClient = (apiKey, proxy) => {
62
+ var createApiClient = (apiKey, proxy, returnError) => {
63
63
  const client = import_axios.default.create({
64
64
  baseURL: proxy != null ? proxy : API_BASE_URL,
65
65
  headers: {
@@ -94,6 +94,9 @@ var createApiClient = (apiKey, proxy) => {
94
94
  apiError.code = "REQUEST_SETUP_ERROR";
95
95
  apiError.details = error;
96
96
  }
97
+ if (returnError) {
98
+ return apiError;
99
+ }
97
100
  throw apiError;
98
101
  }
99
102
  );
@@ -123,13 +126,11 @@ var OTP = class {
123
126
  return data;
124
127
  });
125
128
  }
126
- verify(token) {
129
+ verify(params) {
127
130
  return __async(this, null, function* () {
128
131
  const data = yield this.apiClient.post(
129
132
  "/auth/otp/verify",
130
- {
131
- token
132
- }
133
+ params
133
134
  );
134
135
  return data;
135
136
  });
@@ -139,7 +140,7 @@ var OTP = class {
139
140
  // src/auth/index.ts
140
141
  var Auth = class {
141
142
  constructor(apiKey, proxy) {
142
- this.apiClient = createApiClient(apiKey, proxy);
143
+ this.apiClient = createApiClient(apiKey, proxy, true);
143
144
  this.otp = new OTP(this.apiClient);
144
145
  }
145
146
  retrieveSession(id) {
package/dist/index.mjs CHANGED
@@ -22,7 +22,7 @@ var __async = (__this, __arguments, generator) => {
22
22
  // src/utils/axios.ts
23
23
  import axios from "axios";
24
24
  var API_BASE_URL = "https://api.betterstore.io/v1";
25
- var createApiClient = (apiKey, proxy) => {
25
+ var createApiClient = (apiKey, proxy, returnError) => {
26
26
  const client = axios.create({
27
27
  baseURL: proxy != null ? proxy : API_BASE_URL,
28
28
  headers: {
@@ -57,6 +57,9 @@ var createApiClient = (apiKey, proxy) => {
57
57
  apiError.code = "REQUEST_SETUP_ERROR";
58
58
  apiError.details = error;
59
59
  }
60
+ if (returnError) {
61
+ return apiError;
62
+ }
60
63
  throw apiError;
61
64
  }
62
65
  );
@@ -86,13 +89,11 @@ var OTP = class {
86
89
  return data;
87
90
  });
88
91
  }
89
- verify(token) {
92
+ verify(params) {
90
93
  return __async(this, null, function* () {
91
94
  const data = yield this.apiClient.post(
92
95
  "/auth/otp/verify",
93
- {
94
- token
95
- }
96
+ params
96
97
  );
97
98
  return data;
98
99
  });
@@ -102,7 +103,7 @@ var OTP = class {
102
103
  // src/auth/index.ts
103
104
  var Auth = class {
104
105
  constructor(apiKey, proxy) {
105
- this.apiClient = createApiClient(apiKey, proxy);
106
+ this.apiClient = createApiClient(apiKey, proxy, true);
106
107
  this.otp = new OTP(this.apiClient);
107
108
  }
108
109
  retrieveSession(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betterstore/sdk",
3
- "version": "0.3.81",
3
+ "version": "0.3.83",
4
4
  "description": "E-commerce for Developers",
5
5
  "private": false,
6
6
  "publishConfig": {