@voucherify/sdk 2.2.6 → 2.4.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 +53 -0
- package/README.md +133 -3
- package/dist/Campaigns.d.ts +13 -0
- package/dist/Categories.d.ts +26 -0
- package/dist/Customers.d.ts +17 -0
- package/dist/Loyalties.d.ts +12 -0
- package/dist/Products.d.ts +9 -0
- package/dist/VoucherifyServerSide.d.ts +2 -0
- package/dist/Vouchers.d.ts +5 -0
- package/dist/types/Categories.d.ts +24 -0
- package/dist/types/Customers.d.ts +42 -0
- package/dist/types/Loyalties.d.ts +141 -0
- package/dist/voucherifysdk.esm.js +182 -2
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +186 -6
- 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 +10 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`b11ce2c`](https://github.com/voucherifyio/voucherify-js-sdk/commit/b11ce2c6410c7441bd48fbbf33377b98c77af072) [#241](https://github.com/voucherifyio/voucherify-js-sdk/pull/241) Thanks [@p-zielinski](https://github.com/p-zielinski)! - Add support for 3 missing endpoints in loyalties api. Corrected a typo in one of loyalties api method.
|
|
8
|
+
- Added support for new endpoints: `GET /loyalties/{campaignId}/earning-rules/{earningRuleId}`, `POST /loyalties/{campaignId}/earning-rules/{earningRuleId}/enable` and `POST /loyalties/{campaignId}/earning-rules/{earningRuleId}/disable` [(examples available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)
|
|
9
|
+
- New exported types/interfaces: `LoyaltiesGetEarningRuleResponseBody`, `LoyaltiesEnableEarningRulesResponseBody`, `LoyaltiesDisableEarningRulesResponseBody`, `EarningRuleEvent`, `EarningRuleBase`, `EarningRuleFixed`, `EarningRuleProportionalOrder`, `EarningRuleProportionalOrderAmount`, `EarningRuleProportionalOrderTotalAmount`, `EarningRuleProportionalOrderMetadata`, `EarningRuleProportionalOrderItems`, `EarningRuleProportionalOrderItemsQuantity`, `EarningRuleProportionalOrderItemsAmount`, `EarningRuleProportionalOrderItemsSubtotalAmount`, `EarningRuleProportionalCustomerMetadata`, `EarningRuleProportionalCustomEvent`, `EarningRuleProportional`
|
|
10
|
+
- Added optional parameter `calculation_type` to `LoyaltyProportional`
|
|
11
|
+
|
|
12
|
+
* [`5bb69da`](https://github.com/voucherifyio/voucherify-js-sdk/commit/5bb69daf95c1e16c48eb5070149b88f11bfe1a30) [#229](https://github.com/voucherifyio/voucherify-js-sdk/pull/229) Thanks [@marcin-slezak](https://github.com/marcin-slezak)! - Add missing methods covering Customers API.
|
|
13
|
+
- Added support for new endpoints:
|
|
14
|
+
- `POST /customers/{customerId}/permanent-deletion`,
|
|
15
|
+
- `POST /customers/bulk/async`,
|
|
16
|
+
- `POST /customers/metadata/async` [(examples of usage available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)
|
|
17
|
+
- New domain types:
|
|
18
|
+
- `CustomerBase`
|
|
19
|
+
- `CustomerAddress`
|
|
20
|
+
- New exported types/interfaces:
|
|
21
|
+
- `CustomersUpdateInBulkRequestBody`,
|
|
22
|
+
- `CustomersUpdateMetadataInBulkRequestBody`,
|
|
23
|
+
- `CustomersDeletePermanentlyResponseBody`
|
|
24
|
+
|
|
25
|
+
## 2.3.0
|
|
26
|
+
|
|
27
|
+
### Minor Changes
|
|
28
|
+
|
|
29
|
+
- [`644aa84`](https://github.com/voucherifyio/voucherify-js-sdk/commit/644aa8479843b8625192aa295eb07aa19ba651d7) [#227](https://github.com/voucherifyio/voucherify-js-sdk/pull/227) Thanks [@marcin-slezak](https://github.com/marcin-slezak)! - Added support for missing CSV import endpoints ([(examples of usage available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)):
|
|
30
|
+
- `POST /skus/importCSV`
|
|
31
|
+
- `POST /products/importCSV`
|
|
32
|
+
- `POST /vouchers/importCSV`
|
|
33
|
+
- `POST /customers/importCSV`
|
|
34
|
+
- `POST /campaigns/campaignId/importCSV`
|
|
35
|
+
- Added form-data `4.0.0` to SDK package
|
|
36
|
+
|
|
37
|
+
* [`7720e31`](https://github.com/voucherifyio/voucherify-js-sdk/commit/7720e31baea0db19a7543ae12661fab77176e5ff) [#228](https://github.com/voucherifyio/voucherify-js-sdk/pull/228) Thanks [@marcin-slezak](https://github.com/marcin-slezak)! - Add missing methods covering Categories and Campaigns API.
|
|
38
|
+
- Added support for new endpoints [(examples of usage available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md):
|
|
39
|
+
- `POST /campaigns/campaignId/enable`,
|
|
40
|
+
- `POST /campaigns/campaignId/disable`,
|
|
41
|
+
- `GET, POST DELETE /categories`,
|
|
42
|
+
- `GET PUT /categories/id`.
|
|
43
|
+
- New exported types/interfaces in `Categories.ts`:
|
|
44
|
+
- `ListCategories`,
|
|
45
|
+
- `CategoryObject`,
|
|
46
|
+
- `CreateCategory`,
|
|
47
|
+
- `ResponseCreateCategory`,
|
|
48
|
+
- `ResponseUpdateCategory`,
|
|
49
|
+
- `UpdateCategoryRequest`.
|
|
50
|
+
|
|
51
|
+
- [`52e7f5e`](https://github.com/voucherifyio/voucherify-js-sdk/commit/52e7f5e8d4ea6be4ba1b9d0550cba3ec3d893672) [#221](https://github.com/voucherifyio/voucherify-js-sdk/pull/221) Thanks [@p-zielinski](https://github.com/p-zielinski)! - Implementing the following changes:
|
|
52
|
+
- Update axios from `0.21.4` to `0.27.2` in SDK package
|
|
53
|
+
- Added dotenv `16.3.1` to SDK package dev dependencies.
|
|
54
|
+
- Added frame for integration tests [(more info available in README.md, section "🧪 SDK Tests")](..%2F..%2FREADME.md)
|
|
55
|
+
|
|
3
56
|
## 2.2.6
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -130,7 +130,7 @@ const client = VoucherifyServerSide({
|
|
|
130
130
|
apiUrl: 'https://<region>.api.voucherify.io', // optional
|
|
131
131
|
apiVersion: 'v2018-08-01', // optional
|
|
132
132
|
channel: 'e-commerce', // optional
|
|
133
|
-
customHeaders: { "MY_CUSTOM_HEADER": "my_value" } // optional
|
|
133
|
+
customHeaders: { "MY_CUSTOM_HEADER": "my_value" }, // optional
|
|
134
134
|
timeoutMs: 10000 // optional
|
|
135
135
|
})
|
|
136
136
|
```
|
|
@@ -154,6 +154,7 @@ Methods are provided within `client.vouchers.*` namespace.
|
|
|
154
154
|
- [Update Vouchers Metadata in bulk](#update-vouchers-metadata-in-bulk)
|
|
155
155
|
- [Update Vouchers in bulk](#update-vouchers-in-bulk)
|
|
156
156
|
- [Release Validation Session](#release-validation-session)
|
|
157
|
+
- [Import Vouchers using CSV](#import-vouchers-using-csv)
|
|
157
158
|
|
|
158
159
|
#### [Create Voucher](https://docs.voucherify.io/reference/create-voucher)
|
|
159
160
|
|
|
@@ -237,6 +238,12 @@ client.vouchers.bulkUpdate(vouchers)
|
|
|
237
238
|
client.vouchers.releaseValidationSession(code, sessionKey)
|
|
238
239
|
```
|
|
239
240
|
|
|
241
|
+
#### [Import Vouchers using CSV](https://docs.voucherify.io/reference/import-vouchers-using-csv)
|
|
242
|
+
|
|
243
|
+
```javascript
|
|
244
|
+
client.vouchers.importCSV(filePath)
|
|
245
|
+
```
|
|
246
|
+
|
|
240
247
|
---
|
|
241
248
|
|
|
242
249
|
### Campaigns
|
|
@@ -249,7 +256,10 @@ Methods are provided within `client.campaigns.*` namespace.
|
|
|
249
256
|
- [Add Voucher to Campaign](#add-voucher-to-campaign)
|
|
250
257
|
- [Import Vouchers to Campaign](#import-vouchers-to-campaign)
|
|
251
258
|
- [List Campaigns](#list-campaigns)
|
|
259
|
+
- [Import Vouchers using CSV](#import-vouchers-using-csv)
|
|
252
260
|
- [Examine Campaigns Qualification](#examine-campaigns-qualification)
|
|
261
|
+
- [Enable campaign](#enable-campaign)
|
|
262
|
+
- [Disable campaign](#disable-campaign)
|
|
253
263
|
|
|
254
264
|
#### [Create Campaign](https://docs.voucherify.io/reference/create-campaign)
|
|
255
265
|
|
|
@@ -307,13 +317,30 @@ client.campaigns.list()
|
|
|
307
317
|
client.campaigns.list(params)
|
|
308
318
|
```
|
|
309
319
|
|
|
320
|
+
#### [Import Vouchers to Campaign by CSV](https://docs.voucherify.io/reference/import-vouchers-to-campaign-using-csv)
|
|
321
|
+
|
|
322
|
+
```javascript
|
|
323
|
+
client.campaigns.importVouchersCSV(campaignId, filePath)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### [Enable campaign](https://docs.voucherify.io/reference/enable-campaign)
|
|
327
|
+
|
|
328
|
+
```javascript
|
|
329
|
+
client.campaigns.enable(campaignId)
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
#### [Disable campaign](https://docs.voucherify.io/reference/disable-campaign)
|
|
333
|
+
|
|
334
|
+
```javascript
|
|
335
|
+
client.campaigns.disable(campaignId)
|
|
336
|
+
```
|
|
337
|
+
|
|
310
338
|
#### [Examine Campaigns Qualification](https://docs.voucherify.io/reference/create-qualification-request)
|
|
311
339
|
|
|
312
340
|
```javascript
|
|
313
341
|
client.campaigns.qualifications.examine(body)
|
|
314
342
|
client.campaigns.qualifications.examine(body, params)
|
|
315
343
|
```
|
|
316
|
-
|
|
317
344
|
---
|
|
318
345
|
|
|
319
346
|
### Distributions
|
|
@@ -359,6 +386,46 @@ client.distributions.publications.list(params)
|
|
|
359
386
|
client.distributions.publications.create(params)
|
|
360
387
|
```
|
|
361
388
|
|
|
389
|
+
### Categories
|
|
390
|
+
|
|
391
|
+
Methods are provided within `client.categories.*` namespace.
|
|
392
|
+
|
|
393
|
+
- [Create Category](#create-category)
|
|
394
|
+
- [Update Category](#update-category)
|
|
395
|
+
- [Get Category](#get-category)
|
|
396
|
+
- [Delete Category](#delete-category)
|
|
397
|
+
- [List Categories](#list-categories)
|
|
398
|
+
|
|
399
|
+
#### [Create Category](https://docs.voucherify.io/reference/create-category)
|
|
400
|
+
|
|
401
|
+
```javascript
|
|
402
|
+
client.categories.create(params)
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
#### [Update Category](https://docs.voucherify.io/reference/update-category)
|
|
406
|
+
|
|
407
|
+
```javascript
|
|
408
|
+
client.categories.update(categoryId, params)
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
#### [Get Category](https://docs.voucherify.io/reference/get-category)
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
client.categories.get(categoryId)
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
#### [Delete Category](https://docs.voucherify.io/reference/delete-category)
|
|
418
|
+
|
|
419
|
+
```javascript
|
|
420
|
+
client.categories.delete(categoryId)
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
#### [List Categories](https://docs.voucherify.io/reference/list-categories)
|
|
424
|
+
|
|
425
|
+
```javascript
|
|
426
|
+
client.categories.list()
|
|
427
|
+
```
|
|
428
|
+
|
|
362
429
|
---
|
|
363
430
|
|
|
364
431
|
### Validations
|
|
@@ -507,7 +574,7 @@ Check [promotion's tier object](https://docs.voucherify.io/reference/the-promoti
|
|
|
507
574
|
|
|
508
575
|
```javascript
|
|
509
576
|
client.promotions.tiers.listAll()
|
|
510
|
-
client.promotions.tiers.listAll(params
|
|
577
|
+
client.promotions.tiers.listAll(params)
|
|
511
578
|
```
|
|
512
579
|
|
|
513
580
|
#### [Add Promotion Tier to Campaign](https://docs.voucherify.io/reference/add-promotion-tier-to-campaign)
|
|
@@ -544,9 +611,13 @@ Methods are provided within `client.customers.*` namespace.
|
|
|
544
611
|
- [Get Customer](#get-customer)
|
|
545
612
|
- [Update Customer](#update-customer)
|
|
546
613
|
- [Delete Customer](#delete-customer)
|
|
614
|
+
- [Delete Customer Permanently](#delete-customer-permanently)
|
|
547
615
|
- [List Customers](#list-customers)
|
|
548
616
|
- [Update Customer's Consents](#update-customers-consents)
|
|
549
617
|
- [List Customer's Activities](#list-customers-activities)
|
|
618
|
+
- [Update Customers in bulk](#update-customers-in-bulk)
|
|
619
|
+
- [Update Customers' Metadata in bulk](#update-customers-metadata-in-bulk)
|
|
620
|
+
- [Import and Update Customers using CSV](#import-and-update-customers-using-csv)
|
|
550
621
|
|
|
551
622
|
#### [Create Customer](https://docs.voucherify.io/reference/create-customer)
|
|
552
623
|
|
|
@@ -576,6 +647,12 @@ client.customers.update(customer)
|
|
|
576
647
|
client.customers.delete(customerId)
|
|
577
648
|
```
|
|
578
649
|
|
|
650
|
+
#### [Delete Customer Permanently](https://docs.voucherify.io/reference/delete-customer-permanently)
|
|
651
|
+
|
|
652
|
+
```javascript
|
|
653
|
+
client.customers.deletePermanently(customerId)
|
|
654
|
+
```
|
|
655
|
+
|
|
579
656
|
#### [List Customers](https://docs.voucherify.io/reference/list-customers)
|
|
580
657
|
|
|
581
658
|
```javascript
|
|
@@ -628,6 +705,24 @@ client.customers.listActivities(customerId)
|
|
|
628
705
|
client.customers.listActivities(customerId, params)
|
|
629
706
|
```
|
|
630
707
|
|
|
708
|
+
#### [Import and Update Customers using CSV](https://docs.voucherify.io/reference/import-customers-using-csv)
|
|
709
|
+
|
|
710
|
+
```javascript
|
|
711
|
+
client.customers.importCSV(filePath)
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
#### [Update Customers in bulk](https://docs.voucherify.io/reference/update-customers-in-bulk)
|
|
715
|
+
|
|
716
|
+
```javascript
|
|
717
|
+
client.customers.updateInBulk(customers)
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
#### [Update Customers' Metadata in bulk](https://docs.voucherify.io/reference/update-customers-metadata-in-bulk)
|
|
721
|
+
|
|
722
|
+
```javascript
|
|
723
|
+
client.customers.updateMetadataInBulk(sourceIdsAndMetadata)
|
|
724
|
+
```
|
|
725
|
+
|
|
631
726
|
---
|
|
632
727
|
|
|
633
728
|
### Consents
|
|
@@ -707,6 +802,8 @@ Methods are provided within `client.products.*` namespace.
|
|
|
707
802
|
- [Update SKU](#update-sku)
|
|
708
803
|
- [Delete SKU](#delete-sku)
|
|
709
804
|
- [List all product SKUs](#list-all-product-skus)
|
|
805
|
+
- [Import SKUs using CSV](#import-skus-using-csv)
|
|
806
|
+
- [Import Products using CSV](#import-products-using-csv)
|
|
710
807
|
|
|
711
808
|
#### [Create Product](https://docs.voucherify.io/reference/create-product)
|
|
712
809
|
|
|
@@ -781,6 +878,18 @@ client.products.deleteSku(productId, skuId, { force: true })
|
|
|
781
878
|
client.products.listSkus(productId)
|
|
782
879
|
```
|
|
783
880
|
|
|
881
|
+
#### [Import SKUs using CSV](https://docs.voucherify.io/reference/import-skus-using-csv)
|
|
882
|
+
|
|
883
|
+
```javascript
|
|
884
|
+
client.products.importSkusCSV(filePath)
|
|
885
|
+
```
|
|
886
|
+
|
|
887
|
+
#### [Import Products using CSV](https://docs.voucherify.io/reference/import-products-using-csv)
|
|
888
|
+
|
|
889
|
+
```javascript
|
|
890
|
+
client.products.importCSV(filePath)
|
|
891
|
+
```
|
|
892
|
+
|
|
784
893
|
---
|
|
785
894
|
|
|
786
895
|
### Rewards
|
|
@@ -875,6 +984,9 @@ Methods are provided within `client.loyalties.*` namespace.
|
|
|
875
984
|
- [Create Loyalty Program Earning Rules](#create-loyalty-program-earning-rules)
|
|
876
985
|
- [Update Loyalty Program Earning Rule](#update-loyalty-program-earning-rule)
|
|
877
986
|
- [Delete Loyalty Program Earning Rule](#delete-loyalty-program-earning-rule)
|
|
987
|
+
- [Get Loyalty Program Earning Rule](#get-loyalty-program-earning-rule)
|
|
988
|
+
- [Enable Loyalty Program Earning Rule](#enable-loyalty-program-earning-rule)
|
|
989
|
+
- [Disable Loyalty Program Earning Rule](#disable-loyalty-program-earning-rule)
|
|
878
990
|
- [List Loyalty Program Earning Rules](#list-loyalty-program-earning-rules)
|
|
879
991
|
- [Create Loyalty Program Member](#create-loyalty-program-member)
|
|
880
992
|
- [Get Loyalty Program Member](#get-loyalty-program-member)
|
|
@@ -957,6 +1069,24 @@ client.loyalties.updateEarningRule(campaignId, earningRule)
|
|
|
957
1069
|
client.loyalties.deleteEarningRule(campaignId, earningRuleId)
|
|
958
1070
|
```
|
|
959
1071
|
|
|
1072
|
+
#### [Get Loyalty Program Earning Rule](https://docs.voucherify.io/reference/get-earning-rule)
|
|
1073
|
+
|
|
1074
|
+
```javascript
|
|
1075
|
+
client.loyalties.getEarningRule(campaignId, earningRuleId)
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
#### [Enable Loyalty Program Earning Rule](https://docs.voucherify.io/reference/enable-earning-rule)
|
|
1079
|
+
|
|
1080
|
+
```javascript
|
|
1081
|
+
client.loyalties.enableEarningRule(campaignId, earningRuleId)
|
|
1082
|
+
```
|
|
1083
|
+
|
|
1084
|
+
#### [Disable Loyalty Program Earning Rule](https://docs.voucherify.io/reference/disable-earning-rule)
|
|
1085
|
+
|
|
1086
|
+
```javascript
|
|
1087
|
+
client.loyalties.disableEarningRule(campaignId, earningRuleId)
|
|
1088
|
+
```
|
|
1089
|
+
|
|
960
1090
|
#### [List Loyalty Program Earning Rules](https://docs.voucherify.io/reference/list-earning-rules)
|
|
961
1091
|
|
|
962
1092
|
```javascript
|
package/dist/Campaigns.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as T from './types/Campaigns';
|
|
2
|
+
import * as AAT from './types/AsyncActions';
|
|
2
3
|
import type { RequestController } from './RequestController';
|
|
3
4
|
declare class CampaignsQualifications {
|
|
4
5
|
private client;
|
|
@@ -41,5 +42,17 @@ export declare class Campaigns {
|
|
|
41
42
|
* @see https://docs.voucherify.io/reference/list-campaigns
|
|
42
43
|
*/
|
|
43
44
|
list(params?: T.CampaignsListParams): Promise<T.CampaignsListResponse>;
|
|
45
|
+
/**
|
|
46
|
+
* @see https://api.voucherify.io/v1/campaigns/{campaignId}/importCSV
|
|
47
|
+
*/
|
|
48
|
+
importVouchersCSV(campaignId: string, filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
49
|
+
/**
|
|
50
|
+
* @see https://docs.voucherify.io/reference/enable-campaign
|
|
51
|
+
*/
|
|
52
|
+
enable(campaignId: string): Promise<{}>;
|
|
53
|
+
/**
|
|
54
|
+
* @see https://docs.voucherify.io/reference/disable-campaign
|
|
55
|
+
*/
|
|
56
|
+
disable(campaignId: string): Promise<{}>;
|
|
44
57
|
}
|
|
45
58
|
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as T from './types/Categories';
|
|
2
|
+
import type { RequestController } from './RequestController';
|
|
3
|
+
export declare class Categories {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: RequestController);
|
|
6
|
+
/**
|
|
7
|
+
* @see https://docs.voucherify.io/reference/list-categories
|
|
8
|
+
*/
|
|
9
|
+
list(): Promise<T.ListCategories>;
|
|
10
|
+
/**
|
|
11
|
+
* @see https://docs.voucherify.io/reference/create-category
|
|
12
|
+
*/
|
|
13
|
+
create(createCategory: T.CreateCategory): Promise<T.ResponseCreateCategory>;
|
|
14
|
+
/**
|
|
15
|
+
* @see https://docs.voucherify.io/reference/get-category
|
|
16
|
+
*/
|
|
17
|
+
get(categoryId: string): Promise<T.CategoryObject>;
|
|
18
|
+
/**
|
|
19
|
+
* @see https://docs.voucherify.io/reference/delete-category
|
|
20
|
+
*/
|
|
21
|
+
delete(categoryId: string): Promise<{}>;
|
|
22
|
+
/**
|
|
23
|
+
* @see https://docs.voucherify.io/reference/update-category
|
|
24
|
+
*/
|
|
25
|
+
update(categoryId: string, updateCategory: T.UpdateCategoryRequest): Promise<T.ResponseUpdateCategory>;
|
|
26
|
+
}
|
package/dist/Customers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as T from './types/Customers';
|
|
2
|
+
import * as AAT from './types/AsyncActions';
|
|
2
3
|
import type { RequestController } from './RequestController';
|
|
3
4
|
declare class Customers {
|
|
4
5
|
private client;
|
|
@@ -31,10 +32,22 @@ declare class Customers {
|
|
|
31
32
|
* @see https://docs.voucherify.io/reference/update-customer
|
|
32
33
|
*/
|
|
33
34
|
update(customer: T.CustomersUpdateParams): Promise<T.CustomersCreateResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @see https://docs.voucherify.io/reference/update-customers-in-bulk
|
|
37
|
+
*/
|
|
38
|
+
updateInBulk(customers: T.CustomersUpdateInBulkRequestBody): Promise<AAT.AsyncActionCreateResponse>;
|
|
39
|
+
/**
|
|
40
|
+
* @see https://docs.voucherify.io/reference/update-customers-metadata-in-bulk
|
|
41
|
+
*/
|
|
42
|
+
updateMetadataInBulk(sourceIdsAndMetadata: T.CustomersUpdateMetadataInBulkRequestBody): Promise<AAT.AsyncActionCreateResponse>;
|
|
34
43
|
/**
|
|
35
44
|
* @see https://docs.voucherify.io/reference/delete-customer
|
|
36
45
|
*/
|
|
37
46
|
delete(customerId: string): Promise<undefined>;
|
|
47
|
+
/**
|
|
48
|
+
* @see https://docs.voucherify.io/reference/delete-customer-permanently
|
|
49
|
+
*/
|
|
50
|
+
deletePermanently(customerId: string): Promise<T.CustomersDeletePermanentlyResponseBody>;
|
|
38
51
|
/**
|
|
39
52
|
* @see https://docs.voucherify.io/reference/update-customers-consents
|
|
40
53
|
*/
|
|
@@ -43,5 +56,9 @@ declare class Customers {
|
|
|
43
56
|
* @see https://docs.voucherify.io/reference/get-customer-activities
|
|
44
57
|
*/
|
|
45
58
|
listActivities(customerId: string, params?: T.CustomerActivitiesListQueryParams): Promise<T.CustomerActivitiesListResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* @see https://docs.voucherify.io/reference/import-customers-using-csv
|
|
61
|
+
*/
|
|
62
|
+
importCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
46
63
|
}
|
|
47
64
|
export { Customers };
|
package/dist/Loyalties.d.ts
CHANGED
|
@@ -55,6 +55,18 @@ export declare class Loyalties {
|
|
|
55
55
|
* @see https://docs.voucherify.io/reference/delete-earning-rule
|
|
56
56
|
*/
|
|
57
57
|
deleteEarningRule(campaignId: string, earningRuleId: string): Promise<unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* @see https://docs.voucherify.io/reference/get-earning-rule
|
|
60
|
+
*/
|
|
61
|
+
getEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesGetEarningRuleResponseBody>;
|
|
62
|
+
/**
|
|
63
|
+
* @see https://docs.voucherify.io/reference/enable-earning-rule
|
|
64
|
+
*/
|
|
65
|
+
enableEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesEnableEarningRulesResponseBody>;
|
|
66
|
+
/**
|
|
67
|
+
* @see https://docs.voucherify.io/reference/disable-earning-rule
|
|
68
|
+
*/
|
|
69
|
+
disableEarningRule(campaignId: string, earningRuleId: string): Promise<T.LoyaltiesDisableEarningRulesResponseBody>;
|
|
58
70
|
/**
|
|
59
71
|
* @see https://docs.voucherify.io/reference/list-members
|
|
60
72
|
*/
|
package/dist/Products.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as T from './types/Products';
|
|
2
|
+
import * as AAT from './types/AsyncActions';
|
|
2
3
|
import type { RequestController } from './RequestController';
|
|
3
4
|
export declare class Products {
|
|
4
5
|
private client;
|
|
@@ -51,4 +52,12 @@ export declare class Products {
|
|
|
51
52
|
* @see https://docs.voucherify.io/reference/list-skus
|
|
52
53
|
*/
|
|
53
54
|
listSkus(productId: string): Promise<T.ProductsListSkus>;
|
|
55
|
+
/**
|
|
56
|
+
* @see https://docs.voucherify.io/reference/import-skus-using-csv
|
|
57
|
+
*/
|
|
58
|
+
importSkusCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
59
|
+
/**
|
|
60
|
+
* @see https://docs.voucherify.io/reference/import-products-using-csv
|
|
61
|
+
*/
|
|
62
|
+
importCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
54
63
|
}
|
|
@@ -16,6 +16,7 @@ import { ValidationRules } from './ValidationRules';
|
|
|
16
16
|
import { Segments } from './Segments';
|
|
17
17
|
import { ApiLimitsHandler } from './ApiLimitsHandler';
|
|
18
18
|
import { MetadataSchemas } from './MetadataSchemas';
|
|
19
|
+
import { Categories } from './Categories';
|
|
19
20
|
export interface VoucherifyServerSideOptions {
|
|
20
21
|
/**
|
|
21
22
|
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
@@ -106,6 +107,7 @@ export interface VoucherifyServerSideOptions {
|
|
|
106
107
|
export declare function VoucherifyServerSide(options: VoucherifyServerSideOptions): {
|
|
107
108
|
vouchers: Vouchers;
|
|
108
109
|
campaigns: Campaigns;
|
|
110
|
+
categories: Categories;
|
|
109
111
|
distributions: Distributions;
|
|
110
112
|
validations: Validations;
|
|
111
113
|
redemptions: Redemptions;
|
package/dist/Vouchers.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as T from './types/Vouchers';
|
|
2
|
+
import * as AAT from './types/AsyncActions';
|
|
2
3
|
import type { RequestController } from './RequestController';
|
|
3
4
|
import type { Balance } from './Balance';
|
|
4
5
|
declare class VouchersQualification {
|
|
@@ -61,5 +62,9 @@ export declare class Vouchers {
|
|
|
61
62
|
* @see https://docs.voucherify.io/reference/release-validation-session
|
|
62
63
|
*/
|
|
63
64
|
releaseValidationSession(code: string, sessionKey: string): Promise<unknown>;
|
|
65
|
+
/**
|
|
66
|
+
* @see https://docs.voucherify.io/reference/import-vouchers-using-csv
|
|
67
|
+
*/
|
|
68
|
+
importCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
64
69
|
}
|
|
65
70
|
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface ListCategories {
|
|
2
|
+
object: 'list';
|
|
3
|
+
data_ref: 'data';
|
|
4
|
+
data: CategoryObject[];
|
|
5
|
+
total: number;
|
|
6
|
+
}
|
|
7
|
+
export declare type CategoryObject = ResponseCreateCategory & {
|
|
8
|
+
updated_at?: string;
|
|
9
|
+
};
|
|
10
|
+
export interface CreateCategory {
|
|
11
|
+
name: string;
|
|
12
|
+
hierarchy: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ResponseCreateCategory {
|
|
15
|
+
id: string;
|
|
16
|
+
name: string;
|
|
17
|
+
hierarchy: number;
|
|
18
|
+
created_at: string;
|
|
19
|
+
object: 'category';
|
|
20
|
+
}
|
|
21
|
+
export declare type ResponseUpdateCategory = ResponseCreateCategory & {
|
|
22
|
+
updated_at: string;
|
|
23
|
+
};
|
|
24
|
+
export declare type UpdateCategoryRequest = CreateCategory;
|
|
@@ -124,4 +124,46 @@ declare type IdOrSourceId = {
|
|
|
124
124
|
export declare type CustomersUpdateParams = CustomerRequest & IdOrSourceId;
|
|
125
125
|
export declare type CustomersUpdateResponse = CustomerObject | CustomerUnconfirmed;
|
|
126
126
|
export declare type CustomersUpdateConsentsBody = Record<string, boolean>;
|
|
127
|
+
declare type CustomerBase = {
|
|
128
|
+
name?: string | null;
|
|
129
|
+
description?: string | null;
|
|
130
|
+
email?: string | null;
|
|
131
|
+
phone?: string | null;
|
|
132
|
+
birthdate?: string | null;
|
|
133
|
+
metadata?: Record<string, unknown> | null;
|
|
134
|
+
};
|
|
135
|
+
declare type CustomerAddress = {
|
|
136
|
+
address?: {
|
|
137
|
+
city?: string | null;
|
|
138
|
+
state?: string | null;
|
|
139
|
+
line_1?: string | null;
|
|
140
|
+
line_2?: string | null;
|
|
141
|
+
country?: string | null;
|
|
142
|
+
postal_code?: string | null;
|
|
143
|
+
} | null;
|
|
144
|
+
};
|
|
145
|
+
export declare type CustomersUpdateInBulkRequestBody = (CustomerBase & CustomerAddress & {
|
|
146
|
+
source_id: string | null;
|
|
147
|
+
})[];
|
|
148
|
+
export interface CustomersUpdateMetadataInBulkRequestBody {
|
|
149
|
+
source_ids: string[];
|
|
150
|
+
metadata: Record<string, unknown>;
|
|
151
|
+
}
|
|
152
|
+
export interface CustomersDeletePermanentlyResponseBody {
|
|
153
|
+
id: string;
|
|
154
|
+
created_at: string;
|
|
155
|
+
related_object_id: string;
|
|
156
|
+
related_object: 'customer';
|
|
157
|
+
status: 'DONE';
|
|
158
|
+
data_json: {
|
|
159
|
+
events: number;
|
|
160
|
+
customer_events: number;
|
|
161
|
+
daily_events: number;
|
|
162
|
+
segments: number;
|
|
163
|
+
orders: number;
|
|
164
|
+
order_events: number;
|
|
165
|
+
customer: 1;
|
|
166
|
+
};
|
|
167
|
+
object: 'pernament_deletion';
|
|
168
|
+
}
|
|
127
169
|
export {};
|
|
@@ -154,6 +154,7 @@ export interface LoyaltyFixed {
|
|
|
154
154
|
}
|
|
155
155
|
export interface LoyaltyProportional {
|
|
156
156
|
type: 'PROPORTIONAL';
|
|
157
|
+
calculation_type?: 'ORDER_AMOUNT' | 'ORDER_TOTAL_AMOUNT' | 'ORDER_METADATA' | 'ORDER_ITEMS_QUANTITY' | 'ORDER_ITEMS_AMOUNT' | 'ORDER_ITEMS_SUBTOTAL_AMOUNT' | 'CUSTOMER_METADATA' | 'CUSTOM_EVENT_METADATA';
|
|
157
158
|
order?: {
|
|
158
159
|
amount: {
|
|
159
160
|
every: number;
|
|
@@ -464,4 +465,144 @@ export interface LoyaltyPointsTransfer {
|
|
|
464
465
|
code: string;
|
|
465
466
|
points: number;
|
|
466
467
|
}
|
|
468
|
+
export declare type LoyaltiesGetEarningRuleResponseBody = EarningRuleBase & {
|
|
469
|
+
validation_rule_id: string | null;
|
|
470
|
+
updated_at: string | null;
|
|
471
|
+
active: boolean;
|
|
472
|
+
};
|
|
473
|
+
export declare type LoyaltiesEnableEarningRulesResponseBody = EarningRuleBase & {
|
|
474
|
+
updated_at: string | null;
|
|
475
|
+
active: true;
|
|
476
|
+
};
|
|
477
|
+
export declare type LoyaltiesDisableEarningRulesResponseBody = EarningRuleBase & {
|
|
478
|
+
updated_at: string | null;
|
|
479
|
+
active: false;
|
|
480
|
+
};
|
|
481
|
+
export interface EarningRuleBase {
|
|
482
|
+
id: string;
|
|
483
|
+
created_at: string;
|
|
484
|
+
loyalty: EarningRuleFixed | EarningRuleProportional;
|
|
485
|
+
event?: EarningRuleEvent;
|
|
486
|
+
custom_event?: {
|
|
487
|
+
schema_id: string;
|
|
488
|
+
};
|
|
489
|
+
segment?: {
|
|
490
|
+
id: string;
|
|
491
|
+
};
|
|
492
|
+
source: {
|
|
493
|
+
banner?: string;
|
|
494
|
+
object_id: string;
|
|
495
|
+
object_type: 'campaign';
|
|
496
|
+
};
|
|
497
|
+
loyalty_tier?: {
|
|
498
|
+
id: string;
|
|
499
|
+
};
|
|
500
|
+
object: 'earning_rule';
|
|
501
|
+
automation_id: string;
|
|
502
|
+
start_date?: string;
|
|
503
|
+
expiration_date?: string;
|
|
504
|
+
validity_timeframe?: {
|
|
505
|
+
duration: string;
|
|
506
|
+
interval: string;
|
|
507
|
+
};
|
|
508
|
+
validity_day_of_week?: number[];
|
|
509
|
+
metadata: Record<string, unknown>;
|
|
510
|
+
}
|
|
511
|
+
export declare type EarningRuleEvent = 'order.paid' | 'customer.segment.entered' | 'custom_event' | 'customer.loyalty.tier.upgraded' | 'customer.loyalty.tier.downgraded' | 'customer.loyalty.tier.prolonged' | 'customer.loyalty.tier.joined' | 'customer.loyalty.tier.left';
|
|
512
|
+
export interface EarningRuleFixed {
|
|
513
|
+
type: 'FIXED';
|
|
514
|
+
points: number;
|
|
515
|
+
}
|
|
516
|
+
export declare type EarningRuleProportionalOrder = EarningRuleProportionalOrderAmount | EarningRuleProportionalOrderTotalAmount | EarningRuleProportionalOrderMetadata;
|
|
517
|
+
export interface EarningRuleProportionalOrderAmount {
|
|
518
|
+
type: 'PROPORTIONAL';
|
|
519
|
+
calculation_type: 'ORDER_AMOUNT';
|
|
520
|
+
order: {
|
|
521
|
+
amount: {
|
|
522
|
+
every: number;
|
|
523
|
+
points: number;
|
|
524
|
+
};
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
export interface EarningRuleProportionalOrderTotalAmount {
|
|
528
|
+
type: 'PROPORTIONAL';
|
|
529
|
+
calculation_type: 'ORDER_TOTAL_AMOUNT';
|
|
530
|
+
order: {
|
|
531
|
+
total_amount: {
|
|
532
|
+
every: number;
|
|
533
|
+
points: number;
|
|
534
|
+
};
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
export interface EarningRuleProportionalOrderMetadata {
|
|
538
|
+
type: 'PROPORTIONAL';
|
|
539
|
+
calculation_type: 'ORDER_METADATA';
|
|
540
|
+
order: {
|
|
541
|
+
metadata: {
|
|
542
|
+
every: number;
|
|
543
|
+
points: number;
|
|
544
|
+
property: string;
|
|
545
|
+
};
|
|
546
|
+
};
|
|
547
|
+
}
|
|
548
|
+
export declare type EarningRuleProportional = EarningRuleProportionalOrder | EarningRuleProportionalOrderItems | EarningRuleProportionalCustomerMetadata | EarningRuleProportionalCustomEvent;
|
|
549
|
+
export declare type EarningRuleProportionalOrderItems = EarningRuleProportionalOrderItemsQuantity | EarningRuleProportionalOrderItemsAmount | EarningRuleProportionalOrderItemsSubtotalAmount;
|
|
550
|
+
export interface EarningRuleProportionalOrderItemsQuantity {
|
|
551
|
+
type: 'PROPORTIONAL';
|
|
552
|
+
calculation_type: 'ORDER_ITEMS_QUANTITY';
|
|
553
|
+
order_items: {
|
|
554
|
+
quantity: {
|
|
555
|
+
every: number;
|
|
556
|
+
points: number;
|
|
557
|
+
object: `products_collection` | `product` | `sku`;
|
|
558
|
+
id: string;
|
|
559
|
+
};
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
export interface EarningRuleProportionalOrderItemsAmount {
|
|
563
|
+
type: 'PROPORTIONAL';
|
|
564
|
+
calculation_type: 'ORDER_ITEMS_AMOUNT';
|
|
565
|
+
order_items: {
|
|
566
|
+
amount: {
|
|
567
|
+
every: number;
|
|
568
|
+
points: number;
|
|
569
|
+
object: `products_collection` | `product` | `sku`;
|
|
570
|
+
id: string;
|
|
571
|
+
};
|
|
572
|
+
};
|
|
573
|
+
}
|
|
574
|
+
export interface EarningRuleProportionalOrderItemsSubtotalAmount {
|
|
575
|
+
type: 'PROPORTIONAL';
|
|
576
|
+
calculation_type: 'ORDER_ITEMS_SUBTOTAL_AMOUNT';
|
|
577
|
+
order_items: {
|
|
578
|
+
subtotal_amount: {
|
|
579
|
+
every: number;
|
|
580
|
+
points: number;
|
|
581
|
+
object: `products_collection` | `product` | `sku`;
|
|
582
|
+
id: string;
|
|
583
|
+
};
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
export interface EarningRuleProportionalCustomerMetadata {
|
|
587
|
+
type: 'PROPORTIONAL';
|
|
588
|
+
calculation_type: 'CUSTOMER_METADATA';
|
|
589
|
+
customer: {
|
|
590
|
+
metadata: {
|
|
591
|
+
every: number;
|
|
592
|
+
points: number;
|
|
593
|
+
property: string;
|
|
594
|
+
};
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
export interface EarningRuleProportionalCustomEvent {
|
|
598
|
+
type: 'PROPORTIONAL';
|
|
599
|
+
calculation_type: 'CUSTOM_EVENT_METADATA';
|
|
600
|
+
custom_event: {
|
|
601
|
+
metadata: {
|
|
602
|
+
every: number;
|
|
603
|
+
points: number;
|
|
604
|
+
property: string;
|
|
605
|
+
};
|
|
606
|
+
};
|
|
607
|
+
}
|
|
467
608
|
export {};
|