@voucherify/sdk 2.6.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 +19 -0
- package/README.md +21 -0
- package/dist/ClientSide.d.ts +5 -0
- package/dist/Qualifications.d.ts +10 -0
- package/dist/VoucherifyError.d.ts +3 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/types/ApplicableTo.d.ts +15 -0
- package/dist/types/Customers.d.ts +88 -3
- package/dist/types/DiscountVoucher.d.ts +44 -2
- package/dist/types/Orders.d.ts +110 -1
- package/dist/types/Qualifications.d.ts +86 -0
- package/dist/types/ValidationRules.d.ts +1 -0
- package/dist/types/Vouchers.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/voucherifysdk.esm.js +57 -8
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +57 -8
- 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 +2 -2
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
this.related_object_ids = void 0;
|
|
35
35
|
this.related_object_type = void 0;
|
|
36
36
|
this.related_object_total = void 0;
|
|
37
|
+
this.error = void 0;
|
|
37
38
|
this.cause = void 0;
|
|
38
39
|
this.code = body.code;
|
|
39
40
|
this.key = body.key;
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
this.related_object_ids = body.related_object_ids;
|
|
45
46
|
this.related_object_type = body.related_object_type;
|
|
46
47
|
this.related_object_total = body.related_object_total;
|
|
48
|
+
this.error = body.error;
|
|
47
49
|
this.cause = axiosError;
|
|
48
50
|
}
|
|
49
51
|
|
|
@@ -109,7 +111,13 @@
|
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
setLastResponseHeaders(headers) {
|
|
112
|
-
|
|
114
|
+
const result = {};
|
|
115
|
+
|
|
116
|
+
for (const key in headers) {
|
|
117
|
+
result[key] = String(headers[key]);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
this.lastResponseHeaders = result;
|
|
113
121
|
this.isLastResponseHeadersSet = true;
|
|
114
122
|
}
|
|
115
123
|
|
|
@@ -327,7 +335,10 @@
|
|
|
327
335
|
const fileStream = fs.createReadStream(filePath);
|
|
328
336
|
const form = new FormData();
|
|
329
337
|
form.append('file', fileStream);
|
|
330
|
-
|
|
338
|
+
const headers = {
|
|
339
|
+
'Content-Type': 'multipart/form-data'
|
|
340
|
+
};
|
|
341
|
+
return this.client.post(`/campaigns/${campaignId}/importCSV`, form, undefined, headers);
|
|
331
342
|
}
|
|
332
343
|
/**
|
|
333
344
|
* @see https://docs.voucherify.io/reference/enable-campaign
|
|
@@ -588,7 +599,10 @@
|
|
|
588
599
|
const fileStream = fs.createReadStream(filePath);
|
|
589
600
|
const form = new FormData();
|
|
590
601
|
form.append('file', fileStream);
|
|
591
|
-
|
|
602
|
+
const headers = {
|
|
603
|
+
'Content-Type': 'multipart/form-data'
|
|
604
|
+
};
|
|
605
|
+
return this.client.post('/vouchers/importCSV', form, undefined, headers);
|
|
592
606
|
}
|
|
593
607
|
/**
|
|
594
608
|
* @see https://docs.voucherify.io/reference/list-voucher-transactions
|
|
@@ -958,7 +972,10 @@
|
|
|
958
972
|
const fileStream = fs.createReadStream(filePath);
|
|
959
973
|
const form = new FormData();
|
|
960
974
|
form.append('file', fileStream);
|
|
961
|
-
|
|
975
|
+
const headers = {
|
|
976
|
+
'Content-Type': 'multipart/form-data'
|
|
977
|
+
};
|
|
978
|
+
return this.client.post(`/customers/importCSV`, form, undefined, headers);
|
|
962
979
|
}
|
|
963
980
|
|
|
964
981
|
}
|
|
@@ -1139,7 +1156,10 @@
|
|
|
1139
1156
|
const fileStream = fs.createReadStream(filePath);
|
|
1140
1157
|
const form = new FormData();
|
|
1141
1158
|
form.append('file', fileStream);
|
|
1142
|
-
|
|
1159
|
+
const headers = {
|
|
1160
|
+
'Content-Type': 'multipart/form-data'
|
|
1161
|
+
};
|
|
1162
|
+
return this.client.post(`/skus/importCSV`, form, undefined, headers);
|
|
1143
1163
|
}
|
|
1144
1164
|
/**
|
|
1145
1165
|
* @see https://docs.voucherify.io/reference/import-products-using-csv
|
|
@@ -1152,7 +1172,10 @@
|
|
|
1152
1172
|
const fileStream = fs.createReadStream(filePath);
|
|
1153
1173
|
const form = new FormData();
|
|
1154
1174
|
form.append('file', fileStream);
|
|
1155
|
-
|
|
1175
|
+
const headers = {
|
|
1176
|
+
'Content-Type': 'multipart/form-data'
|
|
1177
|
+
};
|
|
1178
|
+
return this.client.post(`/products/importCSV`, form, undefined, headers);
|
|
1156
1179
|
}
|
|
1157
1180
|
|
|
1158
1181
|
}
|
|
@@ -1879,6 +1902,22 @@
|
|
|
1879
1902
|
|
|
1880
1903
|
}
|
|
1881
1904
|
|
|
1905
|
+
class Qualifications {
|
|
1906
|
+
constructor(client) {
|
|
1907
|
+
this.client = void 0;
|
|
1908
|
+
this.client = client;
|
|
1909
|
+
}
|
|
1910
|
+
/**
|
|
1911
|
+
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
1912
|
+
*/
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
checkEligibility(body) {
|
|
1916
|
+
return this.client.post('/qualifications', body);
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
}
|
|
1920
|
+
|
|
1882
1921
|
// apiLimitsHandler: ApiLimitsHandler
|
|
1883
1922
|
// campaigns: Campaigns
|
|
1884
1923
|
// consents: Consents
|
|
@@ -1909,7 +1948,7 @@
|
|
|
1909
1948
|
let headers = {
|
|
1910
1949
|
'X-App-Id': options.applicationId,
|
|
1911
1950
|
'X-App-Token': options.secretKey,
|
|
1912
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.
|
|
1951
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.7.1"}`,
|
|
1913
1952
|
'Content-Type': 'application/json'
|
|
1914
1953
|
};
|
|
1915
1954
|
|
|
@@ -1951,6 +1990,7 @@
|
|
|
1951
1990
|
const promotions = new Promotions(client, promotionTiers, promotionStack);
|
|
1952
1991
|
const validations = new Validations(client, promotions);
|
|
1953
1992
|
const redemptions = new Redemptions(client);
|
|
1993
|
+
const qualifications = new Qualifications(client);
|
|
1954
1994
|
const customers = new Customers(client);
|
|
1955
1995
|
const consents = new Consents(client);
|
|
1956
1996
|
const orders = new Orders(client);
|
|
@@ -1975,6 +2015,7 @@
|
|
|
1975
2015
|
orders,
|
|
1976
2016
|
products,
|
|
1977
2017
|
productCollections,
|
|
2018
|
+
qualifications,
|
|
1978
2019
|
rewards,
|
|
1979
2020
|
loyalties,
|
|
1980
2021
|
segments,
|
|
@@ -2151,6 +2192,14 @@
|
|
|
2151
2192
|
redeemStackable(params) {
|
|
2152
2193
|
return this.client.post(`/redemptions`, params);
|
|
2153
2194
|
}
|
|
2195
|
+
/**
|
|
2196
|
+
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
2197
|
+
*/
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
qualifications(body) {
|
|
2201
|
+
return this.client.post('/qualifications', body);
|
|
2202
|
+
}
|
|
2154
2203
|
|
|
2155
2204
|
}
|
|
2156
2205
|
|
|
@@ -2165,7 +2214,7 @@
|
|
|
2165
2214
|
let headers = {
|
|
2166
2215
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
2167
2216
|
'X-Client-Token': options.clientSecretKey,
|
|
2168
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.
|
|
2217
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.7.1"}`
|
|
2169
2218
|
};
|
|
2170
2219
|
|
|
2171
2220
|
if (environment().startsWith('Node')) {
|