@voucherify/sdk 2.6.0 → 2.7.0
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 +13 -0
- package/README.md +21 -0
- package/dist/ClientSide.d.ts +5 -0
- package/dist/Qualifications.d.ts +10 -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/index.d.ts +1 -0
- package/dist/voucherifysdk.esm.js +55 -8
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +55 -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
|
@@ -109,7 +109,13 @@
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
setLastResponseHeaders(headers) {
|
|
112
|
-
|
|
112
|
+
const result = {};
|
|
113
|
+
|
|
114
|
+
for (const key in headers) {
|
|
115
|
+
result[key] = String(headers[key]);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
this.lastResponseHeaders = result;
|
|
113
119
|
this.isLastResponseHeadersSet = true;
|
|
114
120
|
}
|
|
115
121
|
|
|
@@ -327,7 +333,10 @@
|
|
|
327
333
|
const fileStream = fs.createReadStream(filePath);
|
|
328
334
|
const form = new FormData();
|
|
329
335
|
form.append('file', fileStream);
|
|
330
|
-
|
|
336
|
+
const headers = {
|
|
337
|
+
'Content-Type': 'multipart/form-data'
|
|
338
|
+
};
|
|
339
|
+
return this.client.post(`/campaigns/${campaignId}/importCSV`, form, undefined, headers);
|
|
331
340
|
}
|
|
332
341
|
/**
|
|
333
342
|
* @see https://docs.voucherify.io/reference/enable-campaign
|
|
@@ -588,7 +597,10 @@
|
|
|
588
597
|
const fileStream = fs.createReadStream(filePath);
|
|
589
598
|
const form = new FormData();
|
|
590
599
|
form.append('file', fileStream);
|
|
591
|
-
|
|
600
|
+
const headers = {
|
|
601
|
+
'Content-Type': 'multipart/form-data'
|
|
602
|
+
};
|
|
603
|
+
return this.client.post('/vouchers/importCSV', form, undefined, headers);
|
|
592
604
|
}
|
|
593
605
|
/**
|
|
594
606
|
* @see https://docs.voucherify.io/reference/list-voucher-transactions
|
|
@@ -958,7 +970,10 @@
|
|
|
958
970
|
const fileStream = fs.createReadStream(filePath);
|
|
959
971
|
const form = new FormData();
|
|
960
972
|
form.append('file', fileStream);
|
|
961
|
-
|
|
973
|
+
const headers = {
|
|
974
|
+
'Content-Type': 'multipart/form-data'
|
|
975
|
+
};
|
|
976
|
+
return this.client.post(`/customers/importCSV`, form, undefined, headers);
|
|
962
977
|
}
|
|
963
978
|
|
|
964
979
|
}
|
|
@@ -1139,7 +1154,10 @@
|
|
|
1139
1154
|
const fileStream = fs.createReadStream(filePath);
|
|
1140
1155
|
const form = new FormData();
|
|
1141
1156
|
form.append('file', fileStream);
|
|
1142
|
-
|
|
1157
|
+
const headers = {
|
|
1158
|
+
'Content-Type': 'multipart/form-data'
|
|
1159
|
+
};
|
|
1160
|
+
return this.client.post(`/skus/importCSV`, form, undefined, headers);
|
|
1143
1161
|
}
|
|
1144
1162
|
/**
|
|
1145
1163
|
* @see https://docs.voucherify.io/reference/import-products-using-csv
|
|
@@ -1152,7 +1170,10 @@
|
|
|
1152
1170
|
const fileStream = fs.createReadStream(filePath);
|
|
1153
1171
|
const form = new FormData();
|
|
1154
1172
|
form.append('file', fileStream);
|
|
1155
|
-
|
|
1173
|
+
const headers = {
|
|
1174
|
+
'Content-Type': 'multipart/form-data'
|
|
1175
|
+
};
|
|
1176
|
+
return this.client.post(`/products/importCSV`, form, undefined, headers);
|
|
1156
1177
|
}
|
|
1157
1178
|
|
|
1158
1179
|
}
|
|
@@ -1879,6 +1900,22 @@
|
|
|
1879
1900
|
|
|
1880
1901
|
}
|
|
1881
1902
|
|
|
1903
|
+
class Qualifications {
|
|
1904
|
+
constructor(client) {
|
|
1905
|
+
this.client = void 0;
|
|
1906
|
+
this.client = client;
|
|
1907
|
+
}
|
|
1908
|
+
/**
|
|
1909
|
+
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
1910
|
+
*/
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
checkEligibility(body) {
|
|
1914
|
+
return this.client.post('/qualifications', body);
|
|
1915
|
+
}
|
|
1916
|
+
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1882
1919
|
// apiLimitsHandler: ApiLimitsHandler
|
|
1883
1920
|
// campaigns: Campaigns
|
|
1884
1921
|
// consents: Consents
|
|
@@ -1909,7 +1946,7 @@
|
|
|
1909
1946
|
let headers = {
|
|
1910
1947
|
'X-App-Id': options.applicationId,
|
|
1911
1948
|
'X-App-Token': options.secretKey,
|
|
1912
|
-
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.
|
|
1949
|
+
'X-Voucherify-Channel': options.channel || `${environment()}-SDK-v${"2.7.0"}`,
|
|
1913
1950
|
'Content-Type': 'application/json'
|
|
1914
1951
|
};
|
|
1915
1952
|
|
|
@@ -1951,6 +1988,7 @@
|
|
|
1951
1988
|
const promotions = new Promotions(client, promotionTiers, promotionStack);
|
|
1952
1989
|
const validations = new Validations(client, promotions);
|
|
1953
1990
|
const redemptions = new Redemptions(client);
|
|
1991
|
+
const qualifications = new Qualifications(client);
|
|
1954
1992
|
const customers = new Customers(client);
|
|
1955
1993
|
const consents = new Consents(client);
|
|
1956
1994
|
const orders = new Orders(client);
|
|
@@ -1975,6 +2013,7 @@
|
|
|
1975
2013
|
orders,
|
|
1976
2014
|
products,
|
|
1977
2015
|
productCollections,
|
|
2016
|
+
qualifications,
|
|
1978
2017
|
rewards,
|
|
1979
2018
|
loyalties,
|
|
1980
2019
|
segments,
|
|
@@ -2151,6 +2190,14 @@
|
|
|
2151
2190
|
redeemStackable(params) {
|
|
2152
2191
|
return this.client.post(`/redemptions`, params);
|
|
2153
2192
|
}
|
|
2193
|
+
/**
|
|
2194
|
+
* @see https://docs.voucherify.io/reference/check-eligibility
|
|
2195
|
+
*/
|
|
2196
|
+
|
|
2197
|
+
|
|
2198
|
+
qualifications(body) {
|
|
2199
|
+
return this.client.post('/qualifications', body);
|
|
2200
|
+
}
|
|
2154
2201
|
|
|
2155
2202
|
}
|
|
2156
2203
|
|
|
@@ -2165,7 +2212,7 @@
|
|
|
2165
2212
|
let headers = {
|
|
2166
2213
|
'X-Client-Application-Id': options.clientApplicationId,
|
|
2167
2214
|
'X-Client-Token': options.clientSecretKey,
|
|
2168
|
-
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.
|
|
2215
|
+
'X-Voucherify-Channel': `${environment()}-ClientSide-SDK-v${"2.7.0"}`
|
|
2169
2216
|
};
|
|
2170
2217
|
|
|
2171
2218
|
if (environment().startsWith('Node')) {
|