@voucherify/sdk 2.2.4 → 2.2.6

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.
@@ -62,7 +62,8 @@
62
62
  basePath,
63
63
  baseURL,
64
64
  headers,
65
- exposeErrorCause
65
+ exposeErrorCause,
66
+ timeoutMs
66
67
  }) {
67
68
  this.baseURL = void 0;
68
69
  this.basePath = void 0;
@@ -71,12 +72,14 @@
71
72
  this.lastResponseHeaders = void 0;
72
73
  this.isLastResponseHeadersSet = void 0;
73
74
  this.exposeErrorCause = void 0;
75
+ this.timeoutMs = void 0;
74
76
  this.basePath = basePath;
75
77
  this.baseURL = baseURL;
76
78
  this.headers = headers;
77
79
  this.exposeErrorCause = exposeErrorCause;
78
80
  this.lastResponseHeaders = {};
79
81
  this.isLastResponseHeadersSet = false;
82
+ this.timeoutMs = timeoutMs;
80
83
  this.request = axios.create({
81
84
  baseURL: `${this.baseURL}/${this.basePath}/`,
82
85
  headers: this.headers,
@@ -119,7 +122,8 @@
119
122
  params,
120
123
  paramsSerializer: function (params) {
121
124
  return Qs.stringify(params);
122
- }
125
+ },
126
+ timeout: this.timeoutMs
123
127
  });
124
128
  this.setLastResponseHeaders(response.headers);
125
129
  return response.data;
@@ -131,7 +135,8 @@
131
135
  paramsSerializer: function (params) {
132
136
  return Qs.stringify(params);
133
137
  },
134
- headers
138
+ headers,
139
+ timeout: this.timeoutMs
135
140
  });
136
141
  this.setLastResponseHeaders(response.headers);
137
142
  return response.data;
@@ -139,7 +144,8 @@
139
144
 
140
145
  async put(path, body, params) {
141
146
  const response = await this.request.put(path, body, {
142
- params
147
+ params,
148
+ timeout: this.timeoutMs
143
149
  });
144
150
  this.setLastResponseHeaders(response.headers);
145
151
  return response.data;
@@ -147,7 +153,8 @@
147
153
 
148
154
  async delete(path, params) {
149
155
  const response = await this.request.delete(path, {
150
- params
156
+ params,
157
+ timeout: this.timeoutMs
151
158
  });
152
159
  this.setLastResponseHeaders(response.headers);
153
160
  return response.data;
@@ -1451,7 +1458,7 @@
1451
1458
  // }
1452
1459
 
1453
1460
  function VoucherifyServerSide(options) {
1454
- var _options$apiUrl, _options$exposeErrorC;
1461
+ var _options$apiUrl, _options$exposeErrorC, _options$timeoutMs;
1455
1462
 
1456
1463
  assert(isObject(options), 'VoucherifyServerSide: the "options" argument must be an object');
1457
1464
  assert(isString(options.applicationId), 'VoucherifyServerSide: "options.applicationId" is required');
@@ -1461,7 +1468,7 @@
1461
1468
  let headers = {
1462
1469
  'X-App-Id': options.applicationId,
1463
1470
  'X-App-Token': options.secretKey,
1464
- 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.2.4"}`,
1471
+ 'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.2.6"}`,
1465
1472
  'Content-Type': 'application/json'
1466
1473
  };
1467
1474
 
@@ -1487,7 +1494,8 @@
1487
1494
  basePath: 'v1',
1488
1495
  baseURL: (_options$apiUrl = options.apiUrl) != null ? _options$apiUrl : 'https://api.voucherify.io',
1489
1496
  headers,
1490
- exposeErrorCause: (_options$exposeErrorC = options.exposeErrorCause) != null ? _options$exposeErrorC : false
1497
+ exposeErrorCause: (_options$exposeErrorC = options.exposeErrorCause) != null ? _options$exposeErrorC : false,
1498
+ timeoutMs: (_options$timeoutMs = options.timeoutMs) != null ? _options$timeoutMs : 0
1491
1499
  });
1492
1500
  const asyncActions = new AsyncActions(client);
1493
1501
  const balance = new Balance(client);
@@ -1701,7 +1709,7 @@
1701
1709
  }
1702
1710
 
1703
1711
  function VoucherifyClientSide(options) {
1704
- var _options$apiUrl, _options$exposeErrorC;
1712
+ var _options$apiUrl, _options$exposeErrorC, _options$timeoutMs;
1705
1713
 
1706
1714
  assert(isObject(options), 'VoucherifyCustomer: expected "options" argument to be an object');
1707
1715
  assert(isString(options.clientApplicationId), 'VoucherifyCustomer: "options.clientApplicationId" is required');
@@ -1711,7 +1719,7 @@
1711
1719
  let headers = {
1712
1720
  'X-Client-Application-Id': options.clientApplicationId,
1713
1721
  'X-Client-Token': options.clientSecretKey,
1714
- 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.2.4"}`
1722
+ 'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.2.6"}`
1715
1723
  };
1716
1724
 
1717
1725
  if (environment().startsWith('Node')) {
@@ -1727,7 +1735,8 @@
1727
1735
  basePath: 'client/v1',
1728
1736
  baseURL: (_options$apiUrl = options.apiUrl) != null ? _options$apiUrl : 'https://api.voucherify.io',
1729
1737
  headers,
1730
- exposeErrorCause: (_options$exposeErrorC = options.exposeErrorCause) != null ? _options$exposeErrorC : false
1738
+ exposeErrorCause: (_options$exposeErrorC = options.exposeErrorCause) != null ? _options$exposeErrorC : false,
1739
+ timeoutMs: (_options$timeoutMs = options.timeoutMs) != null ? _options$timeoutMs : 0
1731
1740
  });
1732
1741
  return new ClientSide(client, options.trackingId);
1733
1742
  }