@voucherify/sdk 2.7.0 → 2.7.1

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,11 @@
1
1
  # @voucherify/sdk
2
2
 
3
+ ## 2.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`25c3f13`](https://github.com/voucherifyio/voucherify-js-sdk/commit/25c3f13d10cd8ed4a6eee50082f302efd18e1268) [#260](https://github.com/voucherifyio/voucherify-js-sdk/pull/260) Thanks [@jkaliszuk](https://github.com/jkaliszuk)! - Added `error` object in `VoucherifyError`. Added `validation_rules` in VouchersCreateParameters.
8
+
3
9
  ## 2.7.0
4
10
 
5
11
  ### Minor Changes
@@ -12,6 +12,9 @@ export declare class VoucherifyError extends Error {
12
12
  related_object_ids?: string[];
13
13
  related_object_type?: string;
14
14
  related_object_total?: number;
15
+ error?: {
16
+ message: string;
17
+ };
15
18
  cause?: AxiosError;
16
19
  constructor(statusCode: number, body?: unknown, axiosError?: AxiosError);
17
20
  }
@@ -128,6 +128,7 @@ export interface VouchersCreateParameters {
128
128
  redemption?: {
129
129
  quantity: number;
130
130
  };
131
+ validation_rules?: string[];
131
132
  }
132
133
  export declare type VouchersCreate = VouchersCreateParameters & Pick<VouchersResponse, 'type' | 'discount' | 'gift' | 'category' | 'additional_info' | 'start_date' | 'expiration_date' | 'metadata'>;
133
134
  export declare type VouchersCreateResponse = Omit<VouchersResponse, 'validation_rules_assignments'>;
@@ -30,6 +30,7 @@ class VoucherifyError extends Error {
30
30
  this.related_object_ids = void 0;
31
31
  this.related_object_type = void 0;
32
32
  this.related_object_total = void 0;
33
+ this.error = void 0;
33
34
  this.cause = void 0;
34
35
  this.code = body.code;
35
36
  this.key = body.key;
@@ -40,6 +41,7 @@ class VoucherifyError extends Error {
40
41
  this.related_object_ids = body.related_object_ids;
41
42
  this.related_object_type = body.related_object_type;
42
43
  this.related_object_total = body.related_object_total;
44
+ this.error = body.error;
43
45
  this.cause = axiosError;
44
46
  }
45
47
 
@@ -1942,7 +1944,7 @@ function VoucherifyServerSide(options) {
1942
1944
  let headers = {
1943
1945
  'X-App-Id': options.applicationId,
1944
1946
  'X-App-Token': options.secretKey,
1945
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.7.0"}`,
1947
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.7.1"}`,
1946
1948
  'Content-Type': 'application/json'
1947
1949
  };
1948
1950
 
@@ -2208,7 +2210,7 @@ function VoucherifyClientSide(options) {
2208
2210
  let headers = {
2209
2211
  'X-Client-Application-Id': options.clientApplicationId,
2210
2212
  'X-Client-Token': options.clientSecretKey,
2211
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.7.0"}`
2213
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.7.1"}`
2212
2214
  };
2213
2215
 
2214
2216
  if (environment().startsWith('Node')) {