@betterstore/sdk 0.3.79 → 0.3.82
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 +18 -0
- package/dist/index.d.mts +11 -4
- package/dist/index.d.ts +11 -4
- package/dist/index.js +5 -2
- package/dist/index.mjs +5 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
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 {
|
|
@@ -308,16 +308,23 @@ type OTPLoginResponse = {
|
|
|
308
308
|
token: string;
|
|
309
309
|
} | {
|
|
310
310
|
success: false;
|
|
311
|
-
code:
|
|
311
|
+
code: "BAD_REQUEST";
|
|
312
|
+
error: string;
|
|
313
|
+
};
|
|
314
|
+
type OTPSignupResponse = {
|
|
315
|
+
success: true;
|
|
316
|
+
token: string;
|
|
317
|
+
} | {
|
|
318
|
+
success: false;
|
|
319
|
+
code: "BAD_REQUEST" | "CUSTOMER_ALREADY_EXISTS";
|
|
312
320
|
error: string;
|
|
313
321
|
};
|
|
314
|
-
type OTPSignupResponse = OTPLoginResponse;
|
|
315
322
|
type OTPVerifyResponse = {
|
|
316
323
|
success: true;
|
|
317
324
|
customerSession: CustomerSession;
|
|
318
325
|
} | {
|
|
319
326
|
success: false;
|
|
320
|
-
code:
|
|
327
|
+
code: "BAD_REQUEST";
|
|
321
328
|
error: string;
|
|
322
329
|
};
|
|
323
330
|
|
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 {
|
|
@@ -308,16 +308,23 @@ type OTPLoginResponse = {
|
|
|
308
308
|
token: string;
|
|
309
309
|
} | {
|
|
310
310
|
success: false;
|
|
311
|
-
code:
|
|
311
|
+
code: "BAD_REQUEST";
|
|
312
|
+
error: string;
|
|
313
|
+
};
|
|
314
|
+
type OTPSignupResponse = {
|
|
315
|
+
success: true;
|
|
316
|
+
token: string;
|
|
317
|
+
} | {
|
|
318
|
+
success: false;
|
|
319
|
+
code: "BAD_REQUEST" | "CUSTOMER_ALREADY_EXISTS";
|
|
312
320
|
error: string;
|
|
313
321
|
};
|
|
314
|
-
type OTPSignupResponse = OTPLoginResponse;
|
|
315
322
|
type OTPVerifyResponse = {
|
|
316
323
|
success: true;
|
|
317
324
|
customerSession: CustomerSession;
|
|
318
325
|
} | {
|
|
319
326
|
success: false;
|
|
320
|
-
code:
|
|
327
|
+
code: "BAD_REQUEST";
|
|
321
328
|
error: string;
|
|
322
329
|
};
|
|
323
330
|
|
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
|
);
|
|
@@ -139,7 +142,7 @@ var OTP = class {
|
|
|
139
142
|
// src/auth/index.ts
|
|
140
143
|
var Auth = class {
|
|
141
144
|
constructor(apiKey, proxy) {
|
|
142
|
-
this.apiClient = createApiClient(apiKey, proxy);
|
|
145
|
+
this.apiClient = createApiClient(apiKey, proxy, true);
|
|
143
146
|
this.otp = new OTP(this.apiClient);
|
|
144
147
|
}
|
|
145
148
|
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
|
);
|
|
@@ -102,7 +105,7 @@ var OTP = class {
|
|
|
102
105
|
// src/auth/index.ts
|
|
103
106
|
var Auth = class {
|
|
104
107
|
constructor(apiKey, proxy) {
|
|
105
|
-
this.apiClient = createApiClient(apiKey, proxy);
|
|
108
|
+
this.apiClient = createApiClient(apiKey, proxy, true);
|
|
106
109
|
this.otp = new OTP(this.apiClient);
|
|
107
110
|
}
|
|
108
111
|
retrieveSession(id) {
|