@voucherify/sdk 2.5.0 → 2.6.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 +98 -0
- package/README.md +46 -2
- package/dist/Categories.d.ts +1 -1
- package/dist/Loyalties.d.ts +9 -5
- package/dist/Promotions.d.ts +3 -1
- package/dist/PromotionsStacks.d.ts +30 -0
- package/dist/Rewards.d.ts +7 -3
- package/dist/ValidationRules.d.ts +4 -0
- package/dist/Vouchers.d.ts +8 -0
- package/dist/types/Categories.d.ts +5 -0
- package/dist/types/Loyalties.d.ts +61 -118
- package/dist/types/PromotionsStacks.d.ts +71 -0
- package/dist/types/Rewards.d.ts +51 -7
- package/dist/types/ValidationRules.d.ts +21 -0
- package/dist/types/Vouchers.d.ts +138 -0
- package/dist/voucherifysdk.esm.js +113 -14
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +113 -14
- 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 +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,103 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`8a3bead`](https://github.com/voucherifyio/voucherify-js-sdk/commit/8a3bead11809f676778d53dddd0ef49f6f17358d) [#252](https://github.com/voucherifyio/voucherify-js-sdk/pull/252) Thanks [@p-zielinski](https://github.com/p-zielinski)! - Added support for new endpoints and adding missing types in Rewards API.
|
|
8
|
+
|
|
9
|
+
Added support for new endpoints:
|
|
10
|
+
|
|
11
|
+
- `/loyalties/{campaignId}/rewards/{assignmentId}`,
|
|
12
|
+
- `/loyalties/{campaignId}/tiers/{tierId}/rewards`,
|
|
13
|
+
- `/rewards/{rewardId}/assignments/{assignmentId}` (example available in readme.md)
|
|
14
|
+
|
|
15
|
+
New exported types/interfaces in `Loyalties.ts`:
|
|
16
|
+
Domain types:
|
|
17
|
+
|
|
18
|
+
- LoyaltyTierRewardItemParameters,
|
|
19
|
+
- LoyaltyTierRewardItemCampaignParameters,
|
|
20
|
+
- LoyaltyTierRewardItemCoinParameters,
|
|
21
|
+
- LoyaltyTierRewardItemMaterialParameters,
|
|
22
|
+
- LoyaltyTierRewardItemCampaignDiscountCoupons,
|
|
23
|
+
- LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram
|
|
24
|
+
|
|
25
|
+
0-level types:
|
|
26
|
+
|
|
27
|
+
- LoyaltiesGetRewardAssignmentResponseBody,
|
|
28
|
+
- LoyaltiesListLoyaltyTierRewardsResponseBody
|
|
29
|
+
|
|
30
|
+
New exported types/interfaces in `Rewards.ts`:
|
|
31
|
+
Domain types:
|
|
32
|
+
|
|
33
|
+
- RewardAssignment (old `RewardsAssignmentObject`),
|
|
34
|
+
- RewardsAssignmentCampaignOrMaterialReward,
|
|
35
|
+
- RewardsAssignmentCoinReward
|
|
36
|
+
-
|
|
37
|
+
|
|
38
|
+
0-level types:
|
|
39
|
+
|
|
40
|
+
- RewardsListAssignmentsRequestQuery (old `RewardsListAssignmentsParams`),
|
|
41
|
+
- RewardsListAssignmentsResponseBody (old `RewardsListAssignmentsResponse`),
|
|
42
|
+
- RewardsCreateAssignmentRequestBody (old `RewardsCreateAssignment`),
|
|
43
|
+
- RewardsCreateAssignmentCoinRewardRequestBody,
|
|
44
|
+
- RewardsCreateAssignmentCampaignOrMaterialRewardRequestBody,
|
|
45
|
+
- RewardsCreateAssignmentResponseBody (old `RewardsCreateAssignmentResponse`),
|
|
46
|
+
- RewardsUpdateAssignmentRequestBody (old `RewardsUpdateAssignment`),
|
|
47
|
+
- RewardsUpdateAssignmentResponseBody (old `RewardsUpdateAssignmentResponse`)
|
|
48
|
+
- RewardsGetAssignmentResponseBody (brand new)
|
|
49
|
+
|
|
50
|
+
***
|
|
51
|
+
|
|
52
|
+
Added support for following endpoints:
|
|
53
|
+
|
|
54
|
+
- GET /vouchers/{code}/transactions (client.vouchers.listTransactions(code, query))
|
|
55
|
+
- POST /vouchers/{code}/transactions/export (client.vouchers.exportTransactions(code, body))
|
|
56
|
+
- GET /validation-rules-assignments (client.client.validationRules.listRulesAssignments(validationRuleId))
|
|
57
|
+
|
|
58
|
+
**New exported types/interfaces**
|
|
59
|
+
Domain types:
|
|
60
|
+
|
|
61
|
+
- GiftCardTransaction
|
|
62
|
+
- GiftCardTransactionBase
|
|
63
|
+
GiftCardTransactionDetails
|
|
64
|
+
- GiftCardTransactionRedemptionDetails
|
|
65
|
+
- GiftCardTransactionRefundDetails
|
|
66
|
+
- GiftCardTransactionAdditionDetails
|
|
67
|
+
- GiftCardTransactionRemovalDetails
|
|
68
|
+
- VoucherTransaction
|
|
69
|
+
- VoucherTransactionsExportFields
|
|
70
|
+
- ValidationRulesAssignment
|
|
71
|
+
|
|
72
|
+
0-level types:
|
|
73
|
+
|
|
74
|
+
- VouchersListTransactionsRequestQuery
|
|
75
|
+
- VouchersListTransactionsResponseBody
|
|
76
|
+
- VouchersExportTransactionsRequestBody
|
|
77
|
+
- VouchersExportTransactionsResponseBody
|
|
78
|
+
- ValidationRulesListRulesAssignmentsRequestQuery
|
|
79
|
+
- ValidationRulesListRulesAssignmentsResponseBody
|
|
80
|
+
|
|
81
|
+
**Other changes**
|
|
82
|
+
|
|
83
|
+
- Use `VouchersExportTransactionsRequestBody` as `LoyaltiesExportCardTransactionsRequestBody` (these types are identical, both related to the export of loyalty card transactions)
|
|
84
|
+
- Use `VouchersExportTransactionsResponseBody` as `LoyaltiesExportCardTransactionsResponseBody` (these types are identical, both related to the export of loyalty card transactions)
|
|
85
|
+
|
|
86
|
+
***
|
|
87
|
+
|
|
88
|
+
New exported types/interfaces in `Categories.ts`:
|
|
89
|
+
|
|
90
|
+
- CategoriesListRequestQuery
|
|
91
|
+
|
|
92
|
+
Added support for query parameters(CategoriesListRequestQuery) in `/categories` (categories.list method)
|
|
93
|
+
|
|
94
|
+
***
|
|
95
|
+
|
|
96
|
+
Add support for few endpoints of Loyalties API:
|
|
97
|
+
|
|
98
|
+
- Added support for new endpoints: `GET /promotions/{campaignId}/stacks`, `GET /promotions/{campaignId}/stacks`, `GET PUT DELETE /promotions/{campaignId}/stacks/{stackId}`, `GET /promotions/stacks` [(examples of usage available in readme.md)](..%2F..%2Fpackages%2Fsdk%2FREADME.md)
|
|
99
|
+
- New exported types/interfaces: `PromotionsStacksListInCampaignResponseBody`, `PromotionsStacksListResponseBody`, `PromotionsStacksListRequestQuery`, `PromotionsStacksGetResponseBody`, `PromotionsStacksUpdateRequestBody`, `PromotionsStacksUpdateResponseBody`, `PromotionsStacksCreateInCampaignRequestBody`, `PromotionsStacksCreateInCampaignResponseBody`, `PromotionStackBase`, `PromotionStack`
|
|
100
|
+
|
|
3
101
|
## 2.5.0
|
|
4
102
|
|
|
5
103
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -155,6 +155,8 @@ Methods are provided within `client.vouchers.*` namespace.
|
|
|
155
155
|
- [Update Vouchers in bulk](#update-vouchers-in-bulk)
|
|
156
156
|
- [Release Validation Session](#release-validation-session)
|
|
157
157
|
- [Import Vouchers using CSV](#import-vouchers-using-csv)
|
|
158
|
+
- [List Voucher Transactions](#list-voucher-transactions)
|
|
159
|
+
- [Export Voucher Transactions](#export-voucher-transactions)
|
|
158
160
|
|
|
159
161
|
#### [Create Voucher](https://docs.voucherify.io/reference/create-voucher)
|
|
160
162
|
|
|
@@ -244,6 +246,18 @@ client.vouchers.releaseValidationSession(code, sessionKey)
|
|
|
244
246
|
client.vouchers.importCSV(filePath)
|
|
245
247
|
```
|
|
246
248
|
|
|
249
|
+
#### [List Voucher Transactions](https://docs.voucherify.io/reference/list-voucher-transactions)
|
|
250
|
+
|
|
251
|
+
```javascript
|
|
252
|
+
client.vouchers.listTransactions(code, query)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### [Export Voucher Transactions](https://docs.voucherify.io/reference/export-voucher-transactions)
|
|
256
|
+
|
|
257
|
+
```javascript
|
|
258
|
+
client.vouchers.exportTransactions(code, body)
|
|
259
|
+
```
|
|
260
|
+
|
|
247
261
|
---
|
|
248
262
|
|
|
249
263
|
### Campaigns
|
|
@@ -950,6 +964,7 @@ Methods are provided within `client.rewards.*` namespace.
|
|
|
950
964
|
- [Update Reward](#update-reward)
|
|
951
965
|
- [Delete Reward](#delete-reward)
|
|
952
966
|
- [List Rewards](#list-rewards)
|
|
967
|
+
- [Get Assignment](#get-reward-assignment)
|
|
953
968
|
- [Create Reward Assignment](#create-reward-assignment)
|
|
954
969
|
- [Update Reward Assignment](#update-reward-assignment)
|
|
955
970
|
- [Delete Reward Assignment](#delete-reward-assignment)
|
|
@@ -988,13 +1003,19 @@ client.rewards.list()
|
|
|
988
1003
|
client.rewards.list(params)
|
|
989
1004
|
```
|
|
990
1005
|
|
|
1006
|
+
#### [Get Reward Assignment](https://docs.voucherify.io/reference/get-reward-assignment)
|
|
1007
|
+
|
|
1008
|
+
```javascript
|
|
1009
|
+
client.rewards.getAssignment(rewardId, assignment)
|
|
1010
|
+
```
|
|
1011
|
+
|
|
991
1012
|
#### [Create Reward Assignment](https://docs.voucherify.io/reference/create-reward-assignment)
|
|
992
1013
|
|
|
993
1014
|
```javascript
|
|
994
1015
|
client.rewards.createAssignment(rewardId, assignment)
|
|
995
1016
|
```
|
|
996
1017
|
|
|
997
|
-
Check [reward assignment object](https://docs.voucherify.io/reference/
|
|
1018
|
+
Check [reward assignment object](https://docs.voucherify.io/reference/reward-assignment-object).
|
|
998
1019
|
|
|
999
1020
|
#### [Update Reward Assignment](https://docs.voucherify.io/reference/update-reward-assignment)
|
|
1000
1021
|
|
|
@@ -1029,6 +1050,7 @@ Methods are provided within `client.loyalties.*` namespace.
|
|
|
1029
1050
|
- [Create Loyalty Program Reward Assignment](#create-loyalty-program-reward-assignment)
|
|
1030
1051
|
- [Update Loyalty Program Reward Assignment](#update-loyalty-program-reward-assignment)
|
|
1031
1052
|
- [Delete Loyalty Program Reward Assignment](#delete-loyalty-program-reward-assignment)
|
|
1053
|
+
- [Get Loyalty Program Reward Assignment](#get-loyalty-program-reward-assignment)
|
|
1032
1054
|
- [List Loyalty Program Reward Assignments](#list-loyalty-program-reward-assignments)
|
|
1033
1055
|
- [Create Loyalty Program Earning Rules](#create-loyalty-program-earning-rules)
|
|
1034
1056
|
- [Update Loyalty Program Earning Rule](#update-loyalty-program-earning-rule)
|
|
@@ -1046,6 +1068,7 @@ Methods are provided within `client.loyalties.*` namespace.
|
|
|
1046
1068
|
- [Transfer Loyalty Points](#transfer-loyalty-points)
|
|
1047
1069
|
- [Get Loyalty Points Expiration](#get-loyalty-points-expiration)
|
|
1048
1070
|
- [Redeem Loyalty Card](#redeem-loyalty-card)
|
|
1071
|
+
- [List Loyalty Tier Rewards](#list-loyalty-tier-rewards)
|
|
1049
1072
|
- [List Loyalty Card Transactions](#list-loyalty-card-transactions)
|
|
1050
1073
|
- [[Export Loyalty Card Transactions](#export-loyalty-card-transactions)
|
|
1051
1074
|
- [Get Reward Assignment](#get-reward-assignment)
|
|
@@ -1105,6 +1128,13 @@ client.loyalties.updateRewardAssignment(campaignId, assignment)
|
|
|
1105
1128
|
client.loyalties.deleteRewardAssignment(campaignId, assignmentId)
|
|
1106
1129
|
```
|
|
1107
1130
|
|
|
1131
|
+
#### [Get Loyalty Program Reward Assignment](https://docs.voucherify.io/reference/get-reward-assignment-2)
|
|
1132
|
+
|
|
1133
|
+
```javascript
|
|
1134
|
+
client.loyalties.getRewardAssignment(campaignId, assignmentId)
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
|
|
1108
1138
|
#### [List Loyalty Program Reward Assignments](https://docs.voucherify.io/reference/list-reward-assignments-1)
|
|
1109
1139
|
|
|
1110
1140
|
```javascript
|
|
@@ -1245,6 +1275,12 @@ client.loyalties.redeemReward(campaignId, memberId, params)
|
|
|
1245
1275
|
|
|
1246
1276
|
When redeeming reward with type `COIN` you need to provide additional `order` object in the `params`
|
|
1247
1277
|
|
|
1278
|
+
#### [List Loyalty Tier Rewards](https://docs.voucherify.io/reference/list-loyalty-tier-rewards)
|
|
1279
|
+
|
|
1280
|
+
```javascript
|
|
1281
|
+
client.loyalties.listLoyaltyTierRewards(campaignId, tierId)
|
|
1282
|
+
```
|
|
1283
|
+
|
|
1248
1284
|
---
|
|
1249
1285
|
|
|
1250
1286
|
#### [List Loyalty Card Transactions](https://docs.voucherify.io/reference/list-loyalty-card-transactions)
|
|
@@ -1372,7 +1408,8 @@ Methods are provided within `client.validationRules.*` namespace.
|
|
|
1372
1408
|
- [Create Rule Assignment](#create-validation-rule-assignment)
|
|
1373
1409
|
- [Delete Rule Assignment](#delete-validation-rule-assignment)
|
|
1374
1410
|
- [List Rules](#list-validation-rules)
|
|
1375
|
-
- [List Rule Assignments](#list-validation-rule-assignments)
|
|
1411
|
+
- [List Validation Rule Assignments](#list-validation-rule-assignments)
|
|
1412
|
+
- [List Validation Rules Assignments](#list-validation-rules-assignments)
|
|
1376
1413
|
|
|
1377
1414
|
#### [Create Validation Rule](https://docs.voucherify.io/reference/create-validation-rules)
|
|
1378
1415
|
|
|
@@ -1426,6 +1463,13 @@ client.validationRules.listAssignments(validationRuleId)
|
|
|
1426
1463
|
client.validationRules.listAssignments(validationRuleId, params)
|
|
1427
1464
|
```
|
|
1428
1465
|
|
|
1466
|
+
#### [List Validation Rules Assignments](https://docs.voucherify.io/reference/list-validation-rules-assignments)
|
|
1467
|
+
|
|
1468
|
+
```javascript
|
|
1469
|
+
client.validationRules.listRulesAssignments(validationRuleId)
|
|
1470
|
+
client.validationRules.listRulesAssignments(validationRuleId, params)
|
|
1471
|
+
```
|
|
1472
|
+
|
|
1429
1473
|
---
|
|
1430
1474
|
|
|
1431
1475
|
### Events
|
package/dist/Categories.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export declare class Categories {
|
|
|
6
6
|
/**
|
|
7
7
|
* @see https://docs.voucherify.io/reference/list-categories
|
|
8
8
|
*/
|
|
9
|
-
list(): Promise<T.ListCategories>;
|
|
9
|
+
list(params?: T.CategoriesListRequestQuery): Promise<T.ListCategories>;
|
|
10
10
|
/**
|
|
11
11
|
* @see https://docs.voucherify.io/reference/create-category
|
|
12
12
|
*/
|
package/dist/Loyalties.d.ts
CHANGED
|
@@ -39,6 +39,10 @@ export declare class Loyalties {
|
|
|
39
39
|
* @see https://docs.voucherify.io/reference/delete-reward-assignment-1
|
|
40
40
|
*/
|
|
41
41
|
deleteRewardAssignment(campaignId: string, assignmentId: string): Promise<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment-2
|
|
44
|
+
*/
|
|
45
|
+
getRewardAssignment(campaignId: string, assignmentId: string): Promise<import("./types").RewardAssignment>;
|
|
42
46
|
/**
|
|
43
47
|
* @see https://docs.voucherify.io/reference/list-earning-rules
|
|
44
48
|
*/
|
|
@@ -110,6 +114,10 @@ export declare class Loyalties {
|
|
|
110
114
|
* @see https://docs.voucherify.io/reference/redeem-loyalty-card
|
|
111
115
|
*/
|
|
112
116
|
redeemReward(campaignId: string, memberId: string, params: T.LoyaltiesRedeemRewardParams): Promise<T.LoyaltiesRedeemRewardResponse>;
|
|
117
|
+
/**
|
|
118
|
+
* @see https://docs.voucherify.io/reference/list-loyalty-tier-rewards
|
|
119
|
+
*/
|
|
120
|
+
listLoyaltyTierRewards(campaignId: string, tierId: string): Promise<T.LoyaltiesListLoyaltyTierRewardsResponseBody>;
|
|
113
121
|
/**
|
|
114
122
|
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions
|
|
115
123
|
* @see https://docs.voucherify.io/reference/list-loyalty-card-transactions-1
|
|
@@ -119,11 +127,7 @@ export declare class Loyalties {
|
|
|
119
127
|
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions
|
|
120
128
|
* @see https://docs.voucherify.io/reference/export-loyalty-card-transactions-1
|
|
121
129
|
*/
|
|
122
|
-
exportCardTransactions(memberId: string, campaignId: string | null, params?: T.LoyaltiesExportCardTransactionsRequestBody): Promise<
|
|
123
|
-
/**
|
|
124
|
-
* @see https://docs.voucherify.io/reference/get-reward-assignment-1
|
|
125
|
-
*/
|
|
126
|
-
getRewardAssignment(campaignId: string, assignmentId: string): Promise<import("./types").RewardAssignment>;
|
|
130
|
+
exportCardTransactions(memberId: string, campaignId: string | null, params?: T.LoyaltiesExportCardTransactionsRequestBody): Promise<import("./types").VouchersExportTransactionsResponseBody>;
|
|
127
131
|
/**
|
|
128
132
|
* @see https://docs.voucherify.io/reference/get-reward-details
|
|
129
133
|
*/
|
package/dist/Promotions.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import * as T from './types/Promotions';
|
|
2
2
|
import type { RequestController } from './RequestController';
|
|
3
3
|
import type { PromotionTiers } from './PromotionTiers';
|
|
4
|
+
import { PromotionsStacks } from './PromotionsStacks';
|
|
4
5
|
export declare class Promotions {
|
|
5
6
|
private client;
|
|
6
7
|
tiers: PromotionTiers;
|
|
7
|
-
|
|
8
|
+
stack: PromotionsStacks;
|
|
9
|
+
constructor(client: RequestController, tiers: PromotionTiers, stack: PromotionsStacks);
|
|
8
10
|
/**
|
|
9
11
|
* @see https://docs.voucherify.io/reference/create-promotion-campaign
|
|
10
12
|
*/
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as T from './types/PromotionsStacks';
|
|
2
|
+
import type { RequestController } from './RequestController';
|
|
3
|
+
export declare class PromotionsStacks {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: RequestController);
|
|
6
|
+
/**
|
|
7
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
8
|
+
*/
|
|
9
|
+
listInCampaign(campaignId: string): Promise<T.PromotionsStacksListInCampaignResponseBody>;
|
|
10
|
+
/**
|
|
11
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
12
|
+
*/
|
|
13
|
+
createInCampaign(campaignId: string, body: T.PromotionsStacksCreateInCampaignRequestBody): Promise<T.PromotionsStacksCreateInCampaignResponseBody>;
|
|
14
|
+
/**
|
|
15
|
+
* @see https://docs.voucherify.io/reference/delete-promotion-stack
|
|
16
|
+
*/
|
|
17
|
+
delete(campaignId: string, stackId: string): Promise<{}>;
|
|
18
|
+
/**
|
|
19
|
+
* @see https://docs.voucherify.io/reference/get-promotion-stack
|
|
20
|
+
*/
|
|
21
|
+
get(campaignId: string, stackId: string): Promise<T.PromotionStack>;
|
|
22
|
+
/**
|
|
23
|
+
* @see https://docs.voucherify.io/reference/update-promotion-stack
|
|
24
|
+
*/
|
|
25
|
+
update(campaignId: string, stackId: string, body: T.PromotionsStacksUpdateRequestBody): Promise<T.PromotionsStacksUpdateResponseBody>;
|
|
26
|
+
/**
|
|
27
|
+
* @see https://docs.voucherify.io/reference/list-promotion-stacks-in-campaign
|
|
28
|
+
*/
|
|
29
|
+
list(params?: T.PromotionsStacksListRequestQuery): Promise<T.PromotionsStacksListResponseBody>;
|
|
30
|
+
}
|
package/dist/Rewards.d.ts
CHANGED
|
@@ -23,17 +23,21 @@ export declare class Rewards {
|
|
|
23
23
|
* @see https://docs.voucherify.io/reference/delete-reward
|
|
24
24
|
*/
|
|
25
25
|
delete(rewardId: string): Promise<unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* @see https://docs.voucherify.io/reference/get-reward-assignment
|
|
28
|
+
*/
|
|
29
|
+
getAssignment(rewardId: string, assignmentId: string): Promise<T.RewardAssignment>;
|
|
26
30
|
/**
|
|
27
31
|
* @see https://docs.voucherify.io/reference/list-reward-assignments
|
|
28
32
|
*/
|
|
29
|
-
listAssignments(rewardId: string, params?: T.
|
|
33
|
+
listAssignments(rewardId: string, params?: T.RewardsListAssignmentsRequestQuery): Promise<T.RewardsListAssignmentsResponseBody>;
|
|
30
34
|
/**
|
|
31
35
|
* @see https://docs.voucherify.io/reference/create-reward-assignment
|
|
32
36
|
*/
|
|
33
|
-
createAssignment(rewardId: string, assignment: T.
|
|
37
|
+
createAssignment(rewardId: string, assignment: T.RewardsCreateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
34
38
|
/**
|
|
35
39
|
* @see https://docs.voucherify.io/reference/update-reward-assignment
|
|
36
40
|
*/
|
|
37
|
-
updateAssignment(rewardId: string, assignment: T.
|
|
41
|
+
updateAssignment(rewardId: string, assignment: T.RewardsUpdateAssignmentRequestBody): Promise<T.RewardAssignment>;
|
|
38
42
|
deleteAssignment(rewardId: string, assignmentId: string): Promise<unknown>;
|
|
39
43
|
}
|
|
@@ -32,6 +32,10 @@ export declare class ValidationRules {
|
|
|
32
32
|
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
33
33
|
*/
|
|
34
34
|
list(params?: T.ValidationRulesListParams): Promise<T.ValidationRulesListResponse>;
|
|
35
|
+
/**
|
|
36
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules-assignments
|
|
37
|
+
*/
|
|
38
|
+
listRulesAssignments(params?: T.ValidationRulesListRulesAssignmentsRequestQuery): Promise<T.ValidationRulesListRulesAssignmentsResponseBody>;
|
|
35
39
|
/**
|
|
36
40
|
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
37
41
|
*/
|
package/dist/Vouchers.d.ts
CHANGED
|
@@ -66,5 +66,13 @@ export declare class Vouchers {
|
|
|
66
66
|
* @see https://docs.voucherify.io/reference/import-vouchers-using-csv
|
|
67
67
|
*/
|
|
68
68
|
importCSV(filePath: string): Promise<AAT.AsyncActionCreateResponse>;
|
|
69
|
+
/**
|
|
70
|
+
* @see https://docs.voucherify.io/reference/list-voucher-transactions
|
|
71
|
+
*/
|
|
72
|
+
listTransactions(code: string, params?: T.VouchersListTransactionsRequestQuery): Promise<T.VouchersListTransactionsResponseBody>;
|
|
73
|
+
/**
|
|
74
|
+
* @see https://docs.voucherify.io/reference/export-voucher-transactions
|
|
75
|
+
*/
|
|
76
|
+
exportTransactions(code: string, body: T.VouchersExportTransactionsRequestBody): Promise<T.VouchersExportTransactionsResponseBody>;
|
|
69
77
|
}
|
|
70
78
|
export {};
|
|
@@ -3,6 +3,7 @@ export interface ListCategories {
|
|
|
3
3
|
data_ref: 'data';
|
|
4
4
|
data: CategoryObject[];
|
|
5
5
|
total: number;
|
|
6
|
+
has_more: boolean;
|
|
6
7
|
}
|
|
7
8
|
export declare type CategoryObject = ResponseCreateCategory & {
|
|
8
9
|
updated_at?: string;
|
|
@@ -30,3 +31,7 @@ export declare type Category = {
|
|
|
30
31
|
updated_at?: string;
|
|
31
32
|
object: 'category';
|
|
32
33
|
};
|
|
34
|
+
export declare type CategoriesListRequestQuery = {
|
|
35
|
+
limit?: number;
|
|
36
|
+
starting_after_id?: number;
|
|
37
|
+
};
|
|
@@ -2,7 +2,7 @@ import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
|
2
2
|
import { ProductsCreateResponse, ProductsCreateSkuResponse } from './Products';
|
|
3
3
|
import { SimpleCustomer } from './Customers';
|
|
4
4
|
import { ValidationRulesCreateAssignmentResponse } from './ValidationRules';
|
|
5
|
-
import { VouchersResponse } from './Vouchers';
|
|
5
|
+
import { VouchersExportTransactionsRequestBody, VouchersExportTransactionsResponseBody, VouchersResponse } from './Vouchers';
|
|
6
6
|
import { Reward, RewardAssignment } from './Rewards';
|
|
7
7
|
import { Category } from './Categories';
|
|
8
8
|
interface LoyaltiesVoucher {
|
|
@@ -559,31 +559,7 @@ export interface LoyaltiesListCardTransactionsResponseBody {
|
|
|
559
559
|
data: LoyaltyCardTransaction[];
|
|
560
560
|
has_more: boolean;
|
|
561
561
|
}
|
|
562
|
-
export
|
|
563
|
-
order?: 'created_at' | '-created_at';
|
|
564
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
565
|
-
}
|
|
566
|
-
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
567
|
-
id: string;
|
|
568
|
-
object: 'export';
|
|
569
|
-
created_at: string;
|
|
570
|
-
status: 'SCHEDULED';
|
|
571
|
-
channel: string;
|
|
572
|
-
exported_object: 'voucher_transactions';
|
|
573
|
-
parameters: {
|
|
574
|
-
order?: string;
|
|
575
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
576
|
-
filters: {
|
|
577
|
-
voucher_id: {
|
|
578
|
-
conditions: {
|
|
579
|
-
$in: [string];
|
|
580
|
-
};
|
|
581
|
-
};
|
|
582
|
-
};
|
|
583
|
-
};
|
|
584
|
-
result: null;
|
|
585
|
-
user_id: null | string;
|
|
586
|
-
}
|
|
562
|
+
export declare type LoyaltiesExportCardTransactionsRequestBody = VouchersExportTransactionsRequestBody;
|
|
587
563
|
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
588
564
|
points: number;
|
|
589
565
|
expiration_date?: string;
|
|
@@ -608,7 +584,6 @@ export declare type LoyaltiesCreateTiersRequestBody = (LoyaltyTierBase & {
|
|
|
608
584
|
metadata?: Record<string, unknown>;
|
|
609
585
|
})[];
|
|
610
586
|
export declare type LoyaltiesCreateTiersResponseBody = LoyaltyTier[];
|
|
611
|
-
export declare type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
612
587
|
export declare type LoyaltiesGetRewardDetailsResponseBody = Reward;
|
|
613
588
|
export interface LoyaltiesListTiersRequestQuery {
|
|
614
589
|
limit?: number;
|
|
@@ -679,31 +654,7 @@ export interface LoyaltiesListCardTransactionsResponseBody {
|
|
|
679
654
|
data: LoyaltyCardTransaction[];
|
|
680
655
|
has_more: boolean;
|
|
681
656
|
}
|
|
682
|
-
export
|
|
683
|
-
order?: 'created_at' | '-created_at';
|
|
684
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
685
|
-
}
|
|
686
|
-
export interface LoyaltiesExportCardTransactionsResponseBody {
|
|
687
|
-
id: string;
|
|
688
|
-
object: 'export';
|
|
689
|
-
created_at: string;
|
|
690
|
-
status: 'SCHEDULED';
|
|
691
|
-
channel: string;
|
|
692
|
-
exported_object: 'voucher_transactions';
|
|
693
|
-
parameters: {
|
|
694
|
-
order?: string;
|
|
695
|
-
fields?: LoyaltyCardTransactionsFields[];
|
|
696
|
-
filters: {
|
|
697
|
-
voucher_id: {
|
|
698
|
-
conditions: {
|
|
699
|
-
$in: [string];
|
|
700
|
-
};
|
|
701
|
-
};
|
|
702
|
-
};
|
|
703
|
-
};
|
|
704
|
-
result: null;
|
|
705
|
-
user_id: null | string;
|
|
706
|
-
}
|
|
657
|
+
export declare type LoyaltiesExportCardTransactionsResponseBody = VouchersExportTransactionsResponseBody;
|
|
707
658
|
export interface LoyaltiesAddOrRemoveCardBalanceRequestBody {
|
|
708
659
|
points: number;
|
|
709
660
|
expiration_date?: string;
|
|
@@ -739,6 +690,30 @@ export declare type LoyaltiesListLoyaltyTierEarningRulesResponseBody = {
|
|
|
739
690
|
data: EarningRule[];
|
|
740
691
|
total: number;
|
|
741
692
|
};
|
|
693
|
+
export declare type LoyaltiesGetRewardAssignmentResponseBody = RewardAssignment;
|
|
694
|
+
export interface LoyaltiesListLoyaltyTierRewardsResponseBody {
|
|
695
|
+
object: 'list';
|
|
696
|
+
data_ref: 'data';
|
|
697
|
+
total: number;
|
|
698
|
+
data: {
|
|
699
|
+
reward: {
|
|
700
|
+
id: string;
|
|
701
|
+
name: string;
|
|
702
|
+
stock: number | null;
|
|
703
|
+
redeemed: number | null;
|
|
704
|
+
attributes?: {
|
|
705
|
+
image_url?: string;
|
|
706
|
+
description?: string;
|
|
707
|
+
};
|
|
708
|
+
metadata: Record<string, undefined>;
|
|
709
|
+
created_at: string;
|
|
710
|
+
updated_at: string | null;
|
|
711
|
+
object: 'reward';
|
|
712
|
+
} & LoyaltyTierRewardItemParameters;
|
|
713
|
+
assignment: RewardAssignment;
|
|
714
|
+
object: 'loyalty_tier_reward';
|
|
715
|
+
}[];
|
|
716
|
+
}
|
|
742
717
|
export interface LoyaltyTierBase {
|
|
743
718
|
name: string;
|
|
744
719
|
earning_rules?: Record<string, MappingMultiply | MappingFixed>;
|
|
@@ -779,72 +754,6 @@ interface MappingFixed {
|
|
|
779
754
|
type: 'CUSTOM';
|
|
780
755
|
points: number;
|
|
781
756
|
}
|
|
782
|
-
export interface LoyaltyCardTransaction {
|
|
783
|
-
id: string;
|
|
784
|
-
source_id: string | null;
|
|
785
|
-
voucher_id: string;
|
|
786
|
-
campaign_id: string;
|
|
787
|
-
source: string | null;
|
|
788
|
-
reason: string | null;
|
|
789
|
-
type: LoyaltyCardTransactionsType;
|
|
790
|
-
details: {
|
|
791
|
-
balance: {
|
|
792
|
-
type: 'loyalty_card';
|
|
793
|
-
total: number;
|
|
794
|
-
object: 'balance';
|
|
795
|
-
points: number;
|
|
796
|
-
balance: number;
|
|
797
|
-
related_object: {
|
|
798
|
-
id: string;
|
|
799
|
-
type: 'voucher';
|
|
800
|
-
};
|
|
801
|
-
};
|
|
802
|
-
order?: {
|
|
803
|
-
id: string;
|
|
804
|
-
source_id: string;
|
|
805
|
-
};
|
|
806
|
-
event?: {
|
|
807
|
-
id: string;
|
|
808
|
-
type: string;
|
|
809
|
-
};
|
|
810
|
-
earning_rule?: {
|
|
811
|
-
id: string;
|
|
812
|
-
source: {
|
|
813
|
-
banner: string;
|
|
814
|
-
};
|
|
815
|
-
};
|
|
816
|
-
segment?: {
|
|
817
|
-
id: string;
|
|
818
|
-
name: string;
|
|
819
|
-
};
|
|
820
|
-
loyalty_tier?: {
|
|
821
|
-
id: string;
|
|
822
|
-
name: string;
|
|
823
|
-
};
|
|
824
|
-
redemption?: {
|
|
825
|
-
id: string;
|
|
826
|
-
};
|
|
827
|
-
rollback?: {
|
|
828
|
-
id: string;
|
|
829
|
-
};
|
|
830
|
-
reward?: {
|
|
831
|
-
id: string;
|
|
832
|
-
name: string;
|
|
833
|
-
};
|
|
834
|
-
custom_event?: {
|
|
835
|
-
id: string;
|
|
836
|
-
type: string;
|
|
837
|
-
};
|
|
838
|
-
event_schema?: {
|
|
839
|
-
id: string;
|
|
840
|
-
name: string;
|
|
841
|
-
};
|
|
842
|
-
source_voucher?: SimpleLoyaltyVoucher;
|
|
843
|
-
destination_voucher?: SimpleLoyaltyVoucher;
|
|
844
|
-
};
|
|
845
|
-
related_transaction_id: string | null;
|
|
846
|
-
created_at: string;
|
|
847
|
-
}
|
|
848
757
|
export interface SimpleLoyaltyVoucher {
|
|
849
758
|
id: string;
|
|
850
759
|
code: string;
|
|
@@ -1094,4 +1003,38 @@ export interface EarningRuleProportionalCustomEvent {
|
|
|
1094
1003
|
};
|
|
1095
1004
|
};
|
|
1096
1005
|
}
|
|
1006
|
+
export declare type LoyaltyTierRewardItemParameters = LoyaltyTierRewardItemCampaignParameters | LoyaltyTierRewardItemCoinParameters | LoyaltyTierRewardItemMaterialParameters;
|
|
1007
|
+
export interface LoyaltyTierRewardItemCampaignParameters {
|
|
1008
|
+
type: 'CAMPAIGN';
|
|
1009
|
+
parameters: {
|
|
1010
|
+
campaign: LoyaltyTierRewardItemCampaignDiscountCoupons | LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram;
|
|
1011
|
+
};
|
|
1012
|
+
}
|
|
1013
|
+
export interface LoyaltyTierRewardItemCoinParameters {
|
|
1014
|
+
type: 'COIN';
|
|
1015
|
+
parameters: {
|
|
1016
|
+
coin: {
|
|
1017
|
+
exchange_ratio: number;
|
|
1018
|
+
points_ratio: number;
|
|
1019
|
+
};
|
|
1020
|
+
};
|
|
1021
|
+
}
|
|
1022
|
+
export interface LoyaltyTierRewardItemMaterialParameters {
|
|
1023
|
+
type: 'MATERIAL';
|
|
1024
|
+
parameters: {
|
|
1025
|
+
product: {
|
|
1026
|
+
id: string;
|
|
1027
|
+
sku_id: string | null;
|
|
1028
|
+
};
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
export interface LoyaltyTierRewardItemCampaignDiscountCoupons {
|
|
1032
|
+
id: string;
|
|
1033
|
+
type: string;
|
|
1034
|
+
}
|
|
1035
|
+
export interface LoyaltyTierRewardItemCampaignGiftVouchersAndLoyaltyProgram {
|
|
1036
|
+
id: string;
|
|
1037
|
+
balance: number;
|
|
1038
|
+
type: string;
|
|
1039
|
+
}
|
|
1097
1040
|
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Category } from './Categories';
|
|
2
|
+
export interface PromotionsStacksListInCampaignResponseBody {
|
|
3
|
+
object: 'list';
|
|
4
|
+
data_ref: 'data';
|
|
5
|
+
data: PromotionStack[];
|
|
6
|
+
total: number;
|
|
7
|
+
}
|
|
8
|
+
export interface PromotionsStacksListResponseBody {
|
|
9
|
+
object: 'list';
|
|
10
|
+
data_ref: 'data';
|
|
11
|
+
data: PromotionStack[];
|
|
12
|
+
total: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PromotionsStacksListRequestQuery {
|
|
15
|
+
limit?: number;
|
|
16
|
+
page?: number;
|
|
17
|
+
order?: 'created_at' | '-created_at' | 'updated_at' | '-updated_at' | 'name' | '-name';
|
|
18
|
+
created_at?: {
|
|
19
|
+
before?: string;
|
|
20
|
+
after?: string;
|
|
21
|
+
};
|
|
22
|
+
updated_at?: {
|
|
23
|
+
before?: string;
|
|
24
|
+
after?: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export declare type PromotionsStacksGetResponseBody = PromotionStack;
|
|
28
|
+
export declare type PromotionsStacksUpdateRequestBody = {
|
|
29
|
+
name: string;
|
|
30
|
+
tiers?: {
|
|
31
|
+
ids?: string[];
|
|
32
|
+
hierarchy_mode?: 'MANUAL';
|
|
33
|
+
};
|
|
34
|
+
category_id?: string;
|
|
35
|
+
};
|
|
36
|
+
export declare type PromotionsStacksUpdateResponseBody = PromotionStackBase & {
|
|
37
|
+
id: string;
|
|
38
|
+
created_at: string;
|
|
39
|
+
updated_at: string;
|
|
40
|
+
campaign_id: string;
|
|
41
|
+
object: 'promotion_stack';
|
|
42
|
+
category_id: string | null;
|
|
43
|
+
categories: Category[];
|
|
44
|
+
};
|
|
45
|
+
export declare type PromotionsStacksCreateInCampaignRequestBody = PromotionStackBase & {
|
|
46
|
+
category_id?: string;
|
|
47
|
+
};
|
|
48
|
+
export declare type PromotionsStacksCreateInCampaignResponseBody = PromotionStackBase & {
|
|
49
|
+
id: string;
|
|
50
|
+
created_at: string;
|
|
51
|
+
campaign_id: string;
|
|
52
|
+
object: 'promotion_stack';
|
|
53
|
+
category_id: string | null;
|
|
54
|
+
categories: Category[];
|
|
55
|
+
};
|
|
56
|
+
export interface PromotionStackBase {
|
|
57
|
+
name: string;
|
|
58
|
+
tiers: {
|
|
59
|
+
ids: string[];
|
|
60
|
+
hierarchy_mode?: 'MANUAL';
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
export declare type PromotionStack = PromotionStackBase & {
|
|
64
|
+
id: string;
|
|
65
|
+
created_at: string;
|
|
66
|
+
updated_at?: string;
|
|
67
|
+
campaign_id: string;
|
|
68
|
+
object: 'promotion_stack';
|
|
69
|
+
category_id: string | null;
|
|
70
|
+
categories: Category[];
|
|
71
|
+
};
|