@voucherify/sdk 2.0.7 → 2.0.10
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 +20 -0
- package/README.md +9 -1
- package/dist/ApiLimitsHandler.d.ts +1 -0
- package/dist/MetadataSchemas.d.ts +6 -0
- package/dist/types/Products.d.ts +1 -0
- package/dist/types/Validations.d.ts +2 -0
- package/dist/voucherifysdk.esm.js +17 -2
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +17 -2
- package/dist/voucherifysdk.umd.development.js.map +1 -1
- package/dist/voucherifysdk.umd.production.min.js +1 -1
- package/dist/voucherifysdk.umd.production.min.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.10
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`e03db27`](https://github.com/voucherifyio/voucherify-js-sdk/commit/e03db276226a579e7d886a8acb5db58b703a6989) [#136](https://github.com/voucherifyio/voucherify-js-sdk/pull/136) Thanks [@darekg11](https://github.com/darekg11)! - Added documentation links to MetadataSchemas API methods
|
|
8
|
+
|
|
9
|
+
* [`a8557d1`](https://github.com/voucherifyio/voucherify-js-sdk/commit/a8557d1c70f0732c6996175d3b1e917c29986cee) [#134](https://github.com/voucherifyio/voucherify-js-sdk/pull/134) Thanks [@salzhrani](https://github.com/salzhrani)! - add metadata property to ProductsCreateResponse
|
|
10
|
+
|
|
11
|
+
## 2.0.9
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`e52b787`](https://github.com/voucherifyio/voucherify-js-sdk/commit/e52b787f48a5aa763d2aaa61b3d28a701548d3cc) [#131](https://github.com/voucherifyio/voucherify-js-sdk/pull/131) Thanks [@tomek-lochmanczyk-rspective](https://github.com/tomek-lochmanczyk-rspective)! - Add function which return "Retry-After" header from response. The purpose is to get information how long it's needed to wait until new requests can be made, when api limits are reached. This ddition is backward compatible so no changes are needed to be made in older code
|
|
16
|
+
|
|
17
|
+
## 2.0.8
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [`e965f61`](https://github.com/voucherifyio/voucherify-js-sdk/commit/e965f615ada65812553a0e5df4409ccf6e02dae1) [#129](https://github.com/voucherifyio/voucherify-js-sdk/pull/129) Thanks [@Irene350](https://github.com/Irene350)! - Adding missing discount amounts on order for validate voucher type response
|
|
22
|
+
|
|
3
23
|
## 2.0.7
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1155,13 +1155,14 @@ Methods are provided within `client.apiLimitsHandler.*` namespace.
|
|
|
1155
1155
|
- [Are Limits Available](#are-limits-available)
|
|
1156
1156
|
- [Get Rate Limit](#get-rate-limit)
|
|
1157
1157
|
- [Get Rate Limit Remaining](#get-rate-limit-remaining)
|
|
1158
|
+
- [Get Retry After](#get-retry-after)
|
|
1158
1159
|
|
|
1159
1160
|
#### Are Limits Available
|
|
1160
1161
|
```javascript
|
|
1161
1162
|
client.apiLimitsHandler.areLimitsAvailable()
|
|
1162
1163
|
```
|
|
1163
1164
|
|
|
1164
|
-
This method should be called each time beforehand [Get Rate Limit](#get-rate-limit) or [Get Rate Limit Remaining](#get-rate-limit-remaining) to ensure limit data are available.
|
|
1165
|
+
This method should be called each time beforehand [Get Rate Limit](#get-rate-limit) or [Get Rate Limit Remaining](#get-rate-limit-remaining) or [Get Retry After](#get-retry-after) to ensure limit data are available.
|
|
1165
1166
|
|
|
1166
1167
|
#### Get Rate Limit
|
|
1167
1168
|
```javascript
|
|
@@ -1177,6 +1178,13 @@ if(client.apiLimitsHandler.areLimitsAvailable()){
|
|
|
1177
1178
|
}
|
|
1178
1179
|
```
|
|
1179
1180
|
|
|
1181
|
+
#### Get Retry After
|
|
1182
|
+
```javascript
|
|
1183
|
+
if(client.apiLimitsHandler.areLimitsAvailable()){
|
|
1184
|
+
client.apiLimitsHandler.getRetryAfter()
|
|
1185
|
+
}
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1180
1188
|
---
|
|
1181
1189
|
|
|
1182
1190
|
# 💅 Client Side
|
|
@@ -3,6 +3,12 @@ import type { RequestController } from './RequestController';
|
|
|
3
3
|
export declare class MetadataSchemas {
|
|
4
4
|
private client;
|
|
5
5
|
constructor(client: RequestController);
|
|
6
|
+
/**
|
|
7
|
+
* @see https://docs.voucherify.io/reference/list-metadata-schemas
|
|
8
|
+
*/
|
|
6
9
|
list(): Promise<T.MetadataSchemasListResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* @see https://docs.voucherify.io/reference/get-metadata-schema
|
|
12
|
+
*/
|
|
7
13
|
get(schemaName: string): Promise<T.MetadataSchema>;
|
|
8
14
|
}
|
package/dist/types/Products.d.ts
CHANGED
|
@@ -22,6 +22,7 @@ export interface ProductsCreateResponse {
|
|
|
22
22
|
attributes?: string[];
|
|
23
23
|
created_at: string;
|
|
24
24
|
image_url?: string;
|
|
25
|
+
metadata?: Record<string, any>;
|
|
25
26
|
}
|
|
26
27
|
export declare type ProductsGetResponse = ProductsCreateResponse & ProductsGetResponseSkus;
|
|
27
28
|
export declare type ProductsUpdate = {
|
|
@@ -50,6 +50,8 @@ export interface ValidationsValidateVoucherResponse {
|
|
|
50
50
|
discount_amount: number;
|
|
51
51
|
total_discount_amount: number;
|
|
52
52
|
total_amount: number;
|
|
53
|
+
applied_discount_amount?: number;
|
|
54
|
+
total_applied_discount_amount?: number;
|
|
53
55
|
items?: OrdersItem[];
|
|
54
56
|
};
|
|
55
57
|
start_date?: string;
|
|
@@ -1356,6 +1356,13 @@ class ApiLimitsHandler {
|
|
|
1356
1356
|
return parseInt(rateLimitRemaining, 10);
|
|
1357
1357
|
}
|
|
1358
1358
|
|
|
1359
|
+
getRetryAfter() {
|
|
1360
|
+
var _this$getLastResponse3;
|
|
1361
|
+
|
|
1362
|
+
const retryAfter = (_this$getLastResponse3 = this.getLastResponseHeadersFromController()['retry-after']) != null ? _this$getLastResponse3 : 0;
|
|
1363
|
+
return parseInt(retryAfter, 10);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1359
1366
|
}
|
|
1360
1367
|
|
|
1361
1368
|
class MetadataSchemas {
|
|
@@ -1363,10 +1370,18 @@ class MetadataSchemas {
|
|
|
1363
1370
|
this.client = void 0;
|
|
1364
1371
|
this.client = client;
|
|
1365
1372
|
}
|
|
1373
|
+
/**
|
|
1374
|
+
* @see https://docs.voucherify.io/reference/list-metadata-schemas
|
|
1375
|
+
*/
|
|
1376
|
+
|
|
1366
1377
|
|
|
1367
1378
|
list() {
|
|
1368
1379
|
return this.client.get('/metadata-schemas');
|
|
1369
1380
|
}
|
|
1381
|
+
/**
|
|
1382
|
+
* @see https://docs.voucherify.io/reference/get-metadata-schema
|
|
1383
|
+
*/
|
|
1384
|
+
|
|
1370
1385
|
|
|
1371
1386
|
get(schemaName) {
|
|
1372
1387
|
return this.client.get(`/metadata-schemas/${encode(schemaName)}`);
|
|
@@ -1404,7 +1419,7 @@ function VoucherifyServerSide(options) {
|
|
|
1404
1419
|
let headers = {
|
|
1405
1420
|
'X-App-Id': options.applicationId,
|
|
1406
1421
|
'X-App-Token': options.secretKey,
|
|
1407
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.
|
|
1422
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.0.10"}`,
|
|
1408
1423
|
'Content-Type': 'application/json'
|
|
1409
1424
|
};
|
|
1410
1425
|
|
|
@@ -1653,7 +1668,7 @@ function VoucherifyClientSide(options) {
|
|
|
1653
1668
|
let headers = {
|
|
1654
1669
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
1655
1670
|
'X-Client-Token': options.clientSecretKey,
|
|
1656
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.
|
|
1671
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.0.10"}`
|
|
1657
1672
|
};
|
|
1658
1673
|
|
|
1659
1674
|
if (environment().startsWith('Node')) {
|