@voucherify/sdk 2.0.3 → 2.0.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.
- package/CHANGELOG.md +18 -0
- package/README.md +86 -0
- package/dist/ApiLimitsHandler.d.ts +9 -0
- package/dist/ClientSide.d.ts +8 -0
- package/dist/MetadataSchemas.d.ts +8 -0
- package/dist/Redemptions.d.ts +9 -0
- package/dist/RequestController.d.ts +5 -0
- package/dist/Validations.d.ts +4 -0
- package/dist/VoucherifyServerSide.d.ts +4 -0
- package/dist/types/ApplicableTo.d.ts +15 -0
- package/dist/types/ClientSide.d.ts +12 -13
- package/dist/types/DiscountVoucher.d.ts +27 -0
- package/dist/types/Gift.d.ts +3 -0
- package/dist/types/Loyalties.d.ts +4 -0
- package/dist/types/MetadataSchemas.d.ts +33 -0
- package/dist/types/Orders.d.ts +10 -0
- package/dist/types/Products.d.ts +10 -0
- package/dist/types/PromotionTiers.d.ts +3 -4
- package/dist/types/Promotions.d.ts +1 -1
- package/dist/types/Redemptions.d.ts +63 -13
- package/dist/types/Rewards.d.ts +5 -0
- package/dist/types/Stackable.d.ts +63 -0
- package/dist/types/ValidateSession.d.ts +17 -0
- package/dist/types/ValidationRules.d.ts +2 -5
- package/dist/types/Validations.d.ts +23 -17
- package/dist/types/Vouchers.d.ts +1 -15
- package/dist/types/index.d.ts +5 -0
- package/dist/voucherifysdk.esm.js +127 -4
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/dist/voucherifysdk.umd.development.js +124 -3
- 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,23 @@
|
|
|
1
1
|
# @voucherify/sdk
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`f8241b7`](https://github.com/voucherifyio/voucherify-js-sdk/commit/f8241b709097f53e29427ba4f4260073375ec91c) [#125](https://github.com/voucherifyio/voucherify-js-sdk/pull/125) Thanks [@darekg11](https://github.com/darekg11)! - Added support for metadata-schemas API. Allowing to list all metadata schemas in project or retrieve single one via get method by providing schema name
|
|
8
|
+
|
|
9
|
+
## 2.0.5
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`a7811e7`](https://github.com/voucherifyio/voucherify-js-sdk/commit/a7811e7e2939efe7a4c59c004dbc9591fcd73030) [#121](https://github.com/voucherifyio/voucherify-js-sdk/pull/121) Thanks [@jkaliszuk](https://github.com/jkaliszuk)! - Added logic that allow to storage lastResponseHeaders data and get apiLimit through ApiLimitsHandler
|
|
14
|
+
|
|
15
|
+
## 2.0.4
|
|
16
|
+
|
|
17
|
+
### Patch Changes
|
|
18
|
+
|
|
19
|
+
- [`f411c1a`](https://github.com/voucherifyio/voucherify-js-sdk/commit/f411c1a56085d80560fdca634e5fdc059a556091) [#119](https://github.com/voucherifyio/voucherify-js-sdk/pull/119) Thanks [@darekg11](https://github.com/darekg11)! - Added support for stackable API methods - validation, redemptions, rollback for both Server Side and Client Side SDKs. Added some missing fields in already existing types definitions and cleaned up other definitions by reusing interfaces
|
|
20
|
+
|
|
3
21
|
## 2.0.3
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -66,6 +66,10 @@ Server side:
|
|
|
66
66
|
<a href="#events">Events</a>
|
|
67
67
|
|
|
|
68
68
|
<a href="#async-actions">Async Actions</a>
|
|
69
|
+
|
|
|
70
|
+
<a href="#metadata-schemas">Metadata Schemas</a>
|
|
71
|
+
|
|
|
72
|
+
<a href="#api-limits-handler">Api Limits Handler</a>
|
|
69
73
|
</p>
|
|
70
74
|
|
|
71
75
|
<p align="center">
|
|
@@ -362,6 +366,7 @@ Methods are provided within `client.validations.*` or `client.promotions.*` name
|
|
|
362
366
|
|
|
363
367
|
- [Validate Voucher](#validate-voucher)
|
|
364
368
|
- [Validate Promotion Campaign](#validate-promotion-campaign)
|
|
369
|
+
- [Validate Stackable](#validate-stackable)
|
|
365
370
|
|
|
366
371
|
#### [Validate Voucher](https://docs.voucherify.io/reference/validate-voucher)
|
|
367
372
|
|
|
@@ -389,6 +394,11 @@ Other possibility
|
|
|
389
394
|
client.validations.validate(params)
|
|
390
395
|
```
|
|
391
396
|
|
|
397
|
+
#### [Validate Stackable](https://docs.voucherify.io/reference/validate-stacked-discounts-1)
|
|
398
|
+
```javascript
|
|
399
|
+
client.validations.validateStackable(params)
|
|
400
|
+
```
|
|
401
|
+
|
|
392
402
|
---
|
|
393
403
|
|
|
394
404
|
### Redemptions
|
|
@@ -396,12 +406,14 @@ client.validations.validate(params)
|
|
|
396
406
|
Methods are provided within `client.redemptions.*` namespace.
|
|
397
407
|
|
|
398
408
|
- [Redeem Voucher](#redeem-voucher)
|
|
409
|
+
- [Redeem Stackable](#redeem-stackable)
|
|
399
410
|
- [Get Redemption](#get-redemption)
|
|
400
411
|
- [Redeem Promotion's Tier](#redeem-promotions-tier)
|
|
401
412
|
- [Redeem Loyalty Card](#redeem-loyalty-card)
|
|
402
413
|
- [List Redemptions](#list-redemptions)
|
|
403
414
|
- [Get Voucher's Redemptions](#get-vouchers-redemptions)
|
|
404
415
|
- [Rollback Redemption](#rollback-redemption)
|
|
416
|
+
- [Rollback Stackable](#rollback-stackable)
|
|
405
417
|
|
|
406
418
|
#### [Redeem Voucher](https://docs.voucherify.io/reference/redeem-voucher)
|
|
407
419
|
|
|
@@ -410,6 +422,11 @@ client.redemptions.redeem(code)
|
|
|
410
422
|
client.redemptions.redeem(code, params)
|
|
411
423
|
```
|
|
412
424
|
|
|
425
|
+
#### [Redeem Stackable](https://docs.voucherify.io/reference/redeem-stacked-discounts)
|
|
426
|
+
```javascript
|
|
427
|
+
client.redemptions.redeemStackable(params)
|
|
428
|
+
```
|
|
429
|
+
|
|
413
430
|
#### [Get Redemption](https://docs.voucherify.io/reference/get-redemption)
|
|
414
431
|
|
|
415
432
|
```javascript
|
|
@@ -436,6 +453,12 @@ client.redemptions.rollback(redemptionId)
|
|
|
436
453
|
client.redemptions.rollback(redemptionId, params)
|
|
437
454
|
```
|
|
438
455
|
|
|
456
|
+
#### [Rollback Stackable](https://docs.voucherify.io/reference/rollback-stackable-redemptions)
|
|
457
|
+
```javascript
|
|
458
|
+
client.redemptions.rollbackStackable(parentRedemptionId)
|
|
459
|
+
client.redemptions.rollbackStackable(parentRedemptionId, params, queryParams)
|
|
460
|
+
```
|
|
461
|
+
|
|
439
462
|
Check [redemption rollback object](https://docs.voucherify.io/reference/the-redemption-rollback-object).
|
|
440
463
|
|
|
441
464
|
---
|
|
@@ -1089,6 +1112,7 @@ Check [customer object](https://docs.voucherify.io/v1/reference#the-customer-obj
|
|
|
1089
1112
|
|
|
1090
1113
|
|
|
1091
1114
|
### Async Actions
|
|
1115
|
+
|
|
1092
1116
|
Methods are provided within `client.asyncActions.*` namespace.
|
|
1093
1117
|
|
|
1094
1118
|
- [Get Async Action](#get-async-action)
|
|
@@ -1105,6 +1129,54 @@ client.asyncActions.list()
|
|
|
1105
1129
|
client.asyncActions.list(params)
|
|
1106
1130
|
```
|
|
1107
1131
|
|
|
1132
|
+
---
|
|
1133
|
+
|
|
1134
|
+
### Metadata Schemas
|
|
1135
|
+
|
|
1136
|
+
Methods are provided within `client.metadataSchemas.*` namespace.
|
|
1137
|
+
|
|
1138
|
+
- [List Metadata Schemas](#list-metadata-schemas)
|
|
1139
|
+
- [Get Metadata Schema by schema name](#get-metadata-schema-by-schema-name)
|
|
1140
|
+
|
|
1141
|
+
#### List Metadata Schemas
|
|
1142
|
+
```javascript
|
|
1143
|
+
client.metadataSchemas.list()
|
|
1144
|
+
```
|
|
1145
|
+
|
|
1146
|
+
#### Get Metadata Schema by schema name
|
|
1147
|
+
```javascript
|
|
1148
|
+
client.metadataSchemas.get(schemaName)
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
### Api Limits Handler
|
|
1152
|
+
|
|
1153
|
+
Methods are provided within `client.apiLimitsHandler.*` namespace.
|
|
1154
|
+
|
|
1155
|
+
- [Are Limits Available](#are-limits-available)
|
|
1156
|
+
- [Get Rate Limit](#get-rate-limit)
|
|
1157
|
+
- [Get Rate Limit Remaining](#get-rate-limit-remaining)
|
|
1158
|
+
|
|
1159
|
+
#### Are Limits Available
|
|
1160
|
+
```javascript
|
|
1161
|
+
client.apiLimitsHandler.areLimitsAvailable()
|
|
1162
|
+
```
|
|
1163
|
+
|
|
1164
|
+
This method should be called each time beforehand [Get Rate Limit](#get-rate-limit) or [Get Rate Limit Remaining](#get-rate-limit-remaining) to ensure limit data are available.
|
|
1165
|
+
|
|
1166
|
+
#### Get Rate Limit
|
|
1167
|
+
```javascript
|
|
1168
|
+
if(client.apiLimitsHandler.areLimitsAvailable()){
|
|
1169
|
+
client.apiLimitsHandler.getRateLimit()
|
|
1170
|
+
}
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
#### Get Rate Limit Remaining
|
|
1174
|
+
```javascript
|
|
1175
|
+
if(client.apiLimitsHandler.areLimitsAvailable()){
|
|
1176
|
+
client.apiLimitsHandler.getRateLimitRemaining()
|
|
1177
|
+
}
|
|
1178
|
+
```
|
|
1179
|
+
|
|
1108
1180
|
---
|
|
1109
1181
|
|
|
1110
1182
|
# 💅 Client Side
|
|
@@ -1137,7 +1209,9 @@ Methods are provided within `client.*` namespace.
|
|
|
1137
1209
|
|
|
1138
1210
|
- [Set Identity](#set-identity)
|
|
1139
1211
|
- [Validate](#validate)
|
|
1212
|
+
- [Validate Stackable](#validate-stackable-client-side)
|
|
1140
1213
|
- [Redeem](#redeem)
|
|
1214
|
+
- [Redeem Stackable](#redeem-stackable-client-side)
|
|
1141
1215
|
- [Publish](#publish)
|
|
1142
1216
|
- [List vouchers](#list-vouchers)
|
|
1143
1217
|
- [Create customer](#create-customer)
|
|
@@ -1157,12 +1231,24 @@ client.setIdentity(trackingId)
|
|
|
1157
1231
|
client.validate(params)
|
|
1158
1232
|
```
|
|
1159
1233
|
|
|
1234
|
+
#### [Validate Stackable Client Side](https://docs.voucherify.io/reference/validate-stackable-discounts-client-side)
|
|
1235
|
+
|
|
1236
|
+
```javascript
|
|
1237
|
+
client.validateStackable(params)
|
|
1238
|
+
```
|
|
1239
|
+
|
|
1160
1240
|
#### [Redeem](https://docs.voucherify.io/reference/redeem-voucher-client-side)
|
|
1161
1241
|
|
|
1162
1242
|
```javascript
|
|
1163
1243
|
client.redeem(code, payload)
|
|
1164
1244
|
```
|
|
1165
1245
|
|
|
1246
|
+
#### [Redeem Stackable Client Side](https://docs.voucherify.io/reference/redeem-stackable-discounts-client-side)
|
|
1247
|
+
|
|
1248
|
+
```javascript
|
|
1249
|
+
client.redeemStackable(params)
|
|
1250
|
+
```
|
|
1251
|
+
|
|
1166
1252
|
#### Publish
|
|
1167
1253
|
|
|
1168
1254
|
```javascript
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RequestController } from './RequestController';
|
|
2
|
+
export declare class ApiLimitsHandler {
|
|
3
|
+
private readonly requestController;
|
|
4
|
+
constructor(requestController: RequestController);
|
|
5
|
+
private getLastResponseHeadersFromController;
|
|
6
|
+
areLimitsAvailable(): boolean;
|
|
7
|
+
getRateLimit(): number;
|
|
8
|
+
getRateLimitRemaining(): number;
|
|
9
|
+
}
|
package/dist/ClientSide.d.ts
CHANGED
|
@@ -37,4 +37,12 @@ export declare class ClientSide {
|
|
|
37
37
|
* @see https://docs.voucherify.io/reference/update-customers-consents-client
|
|
38
38
|
*/
|
|
39
39
|
updateConsents(idOrSourceId: string, consents: T.ClientSideCustomersUpdateConsentsBody): Promise<undefined>;
|
|
40
|
+
/**
|
|
41
|
+
* @see https://docs.voucherify.io/reference/validate-stackable-discounts-client-side
|
|
42
|
+
*/
|
|
43
|
+
validateStackable(params: T.ClientSideValidationsValidateStackableParams): Promise<import("./types").ValidationValidateStackableResponse>;
|
|
44
|
+
/**
|
|
45
|
+
* @see https://docs.voucherify.io/reference/redeem-stackable-discounts-client-side
|
|
46
|
+
*/
|
|
47
|
+
redeemStackable(params: T.ClientSideRedemptionsRedeemStackableParams): Promise<import("./types").RedemptionsRedeemStackableResponse>;
|
|
40
48
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as T from './types/MetadataSchemas';
|
|
2
|
+
import type { RequestController } from './RequestController';
|
|
3
|
+
export declare class MetadataSchemas {
|
|
4
|
+
private client;
|
|
5
|
+
constructor(client: RequestController);
|
|
6
|
+
list(): Promise<T.MetadataSchemasListResponse>;
|
|
7
|
+
get(schemaName: string): Promise<T.MetadataSchema>;
|
|
8
|
+
}
|
package/dist/Redemptions.d.ts
CHANGED
|
@@ -7,6 +7,10 @@ export declare class Redemptions {
|
|
|
7
7
|
* @see https://docs.voucherify.io/reference/redeem-voucher
|
|
8
8
|
*/
|
|
9
9
|
redeem(code: string, body?: T.RedemptionsRedeemBody): Promise<T.RedemptionsRedeemResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* @see https://docs.voucherify.io/reference/redeem-stacked-discounts
|
|
12
|
+
*/
|
|
13
|
+
redeemStackable(params: T.RedemptionsRedeemStackableParams): Promise<T.RedemptionsRedeemStackableResponse>;
|
|
10
14
|
/**
|
|
11
15
|
* @see https://docs.voucherify.io/reference/get-redemption
|
|
12
16
|
*/
|
|
@@ -23,4 +27,9 @@ export declare class Redemptions {
|
|
|
23
27
|
* @see https://docs.voucherify.io/reference/rollback-redemption
|
|
24
28
|
*/
|
|
25
29
|
rollback(redemptionId: string, params?: T.RedemptionsRollbackParams): Promise<T.RedemptionsRollbackResponse>;
|
|
30
|
+
/**
|
|
31
|
+
* @see https://docs.voucherify.io/reference/rollback-stackable-redemptions
|
|
32
|
+
* Types of params and queryParams WILL be changed in future - please do not depend on it!
|
|
33
|
+
*/
|
|
34
|
+
rollbackStackable(parentRedemptionId: string, params?: any, queryParams?: any): Promise<T.RedemptionsRollbackStackableResponse>;
|
|
26
35
|
}
|
|
@@ -11,7 +11,12 @@ export declare class RequestController {
|
|
|
11
11
|
private basePath;
|
|
12
12
|
private headers;
|
|
13
13
|
private request;
|
|
14
|
+
private lastResponseHeaders;
|
|
15
|
+
private isLastResponseHeadersSet;
|
|
14
16
|
constructor({ basePath, baseURL, headers }: RequestControllerOptions);
|
|
17
|
+
isLastReponseHeadersSet(): boolean;
|
|
18
|
+
getLastResponseHeaders(): Record<string, string>;
|
|
19
|
+
private setLastResponseHeaders;
|
|
15
20
|
setBaseUrl(baseURL: string): void;
|
|
16
21
|
get<T>(path: string, params?: Record<string, any>): Promise<T>;
|
|
17
22
|
post<T>(path: string, body: Record<string, any>, params?: Record<string, any>, headers?: Record<string, any>): Promise<T>;
|
package/dist/Validations.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export declare class Validations {
|
|
|
10
10
|
*/
|
|
11
11
|
validateVoucher(code: string, params?: T.ValidationsValidateVoucherParams): Promise<T.ValidationsValidateVoucherResponse>;
|
|
12
12
|
validate(code: string | T.ValidationsValidateCode, context?: T.ValidationsValidateContext): Promise<T.ValidationsValidateVoucherResponse> | Promise<import("./types").PromotionsValidateResponse>;
|
|
13
|
+
/**
|
|
14
|
+
* @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
|
|
15
|
+
*/
|
|
16
|
+
validateStackable(params: T.ValidationsValidateStackableParams): Promise<T.ValidationValidateStackableResponse>;
|
|
13
17
|
}
|
|
@@ -14,6 +14,8 @@ import { Rewards } from './Rewards';
|
|
|
14
14
|
import { Loyalties } from './Loyalties';
|
|
15
15
|
import { ValidationRules } from './ValidationRules';
|
|
16
16
|
import { Segments } from './Segments';
|
|
17
|
+
import { ApiLimitsHandler } from './ApiLimitsHandler';
|
|
18
|
+
import { MetadataSchemas } from './MetadataSchemas';
|
|
17
19
|
export interface VoucherifyServerSideOptions {
|
|
18
20
|
/**
|
|
19
21
|
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
@@ -108,4 +110,6 @@ export declare function VoucherifyServerSide(options: VoucherifyServerSideOption
|
|
|
108
110
|
validationRules: ValidationRules;
|
|
109
111
|
events: Events;
|
|
110
112
|
asyncActions: AsyncActions;
|
|
113
|
+
apiLimitsHandler: ApiLimitsHandler;
|
|
114
|
+
metadataSchemas: MetadataSchemas;
|
|
111
115
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare type ApplicableToEffect = 'APPLY_TO_EVERY' | 'APPLY_TO_CHEAPEST' | 'APPLY_TO_MOST_EXPENSIVE';
|
|
2
|
+
export interface ApplicableTo {
|
|
3
|
+
object: 'product' | 'sku' | 'products_collection';
|
|
4
|
+
id: string;
|
|
5
|
+
source_id?: string;
|
|
6
|
+
strict: boolean;
|
|
7
|
+
price?: number;
|
|
8
|
+
price_formula?: number;
|
|
9
|
+
effect: ApplicableToEffect;
|
|
10
|
+
}
|
|
11
|
+
export interface ApplicableToResultList {
|
|
12
|
+
object: 'list';
|
|
13
|
+
total: number;
|
|
14
|
+
data: ApplicableTo[];
|
|
15
|
+
}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import { CustomerRequest, CustomersCreateBody, CustomersCreateResponse, CustomersUpdateConsentsBody } from './Customers';
|
|
2
|
-
import {
|
|
2
|
+
import { VouchersListParams, VouchersResponse } from './Vouchers';
|
|
3
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
3
4
|
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
4
5
|
import { ConsentsListResponse } from './Consents';
|
|
5
6
|
import { DistributionsPublicationsCreateResponse } from './Distributions';
|
|
6
7
|
import { SimplePromotionTier } from './PromotionTiers';
|
|
8
|
+
import { ValidationSessionReleaseParams } from './ValidateSession';
|
|
9
|
+
import { ApplicableToResultList } from './ApplicableTo';
|
|
10
|
+
import { ValidationsValidateStackableParams, ValidationValidateStackableResponse } from './Validations';
|
|
11
|
+
import { RedemptionsRedeemStackableParams, RedemptionsRedeemStackableResponse } from './Redemptions';
|
|
7
12
|
declare type ClientSideItem = Pick<OrdersItem, 'source_id' | 'sku_id' | 'product_id' | 'sku' | 'quantity' | 'related_object' | 'amount'>;
|
|
8
13
|
export declare type ClientSideCustomersUpdateConsentsBody = CustomersUpdateConsentsBody;
|
|
9
14
|
export declare type ClientSideCustomersCreateParams = CustomersCreateBody;
|
|
@@ -36,15 +41,7 @@ export interface ClientSideValidateResponse {
|
|
|
36
41
|
code?: string;
|
|
37
42
|
valid: boolean;
|
|
38
43
|
discount?: DiscountUnit | DiscountAmount | DiscountPercent;
|
|
39
|
-
applicable_to?:
|
|
40
|
-
object: 'list';
|
|
41
|
-
total: number;
|
|
42
|
-
data?: {
|
|
43
|
-
id: string;
|
|
44
|
-
object: 'product';
|
|
45
|
-
source_id?: string;
|
|
46
|
-
}[];
|
|
47
|
-
};
|
|
44
|
+
applicable_to?: ApplicableToResultList;
|
|
48
45
|
order?: {
|
|
49
46
|
amount: number;
|
|
50
47
|
discount_amount: number;
|
|
@@ -71,9 +68,7 @@ export interface ClientSideRedeemPayload {
|
|
|
71
68
|
reward?: {
|
|
72
69
|
id: string;
|
|
73
70
|
};
|
|
74
|
-
session?:
|
|
75
|
-
key: string;
|
|
76
|
-
};
|
|
71
|
+
session?: ValidationSessionReleaseParams;
|
|
77
72
|
}
|
|
78
73
|
export interface ClientSideRedeemResponse {
|
|
79
74
|
id: string;
|
|
@@ -132,4 +127,8 @@ export interface ClientSideRedeemWidgetPayload {
|
|
|
132
127
|
}
|
|
133
128
|
export declare type ClientSideTrackCustomer = CustomerRequest;
|
|
134
129
|
export declare type ClientSideConsentsListResponse = ConsentsListResponse;
|
|
130
|
+
export declare type ClientSideValidationsValidateStackableParams = ValidationsValidateStackableParams;
|
|
131
|
+
export declare type ClientSideValidationValidateStackableResponse = ValidationValidateStackableResponse;
|
|
132
|
+
export declare type ClientSideRedemptionsRedeemStackableParams = RedemptionsRedeemStackableParams;
|
|
133
|
+
export declare type ClientSideRedemptionsRedeemStackableResponse = RedemptionsRedeemStackableResponse;
|
|
135
134
|
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export declare type DiscountVouchersTypes = 'AMOUNT' | 'PERCENT' | 'UNIT' | 'FIXED';
|
|
2
|
+
export declare enum DiscountVouchersTypesEnum {
|
|
3
|
+
AMOUNT = "AMOUNT",
|
|
4
|
+
PERCENT = "PERCENT",
|
|
5
|
+
UNIT = "UNIT",
|
|
6
|
+
FIXED = "FIXED"
|
|
7
|
+
}
|
|
8
|
+
export declare type DiscountVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS' | 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
9
|
+
export declare type DiscountUnitVouchersEffectTypes = 'ADD_MISSING_ITEMS' | 'ADD_NEW_ITEMS' | 'ADD_MANY_ITEMS';
|
|
10
|
+
export declare type DiscountAmountVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS' | 'APPLY_TO_ITEMS_PROPORTIONALLY' | 'APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY';
|
|
11
|
+
export declare type DiscountPercentVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
12
|
+
export declare type DiscountFixedVouchersEffectTypes = 'APPLY_TO_ORDER' | 'APPLY_TO_ITEMS';
|
|
13
|
+
export interface DiscountUnit {
|
|
14
|
+
type?: DiscountVouchersTypesEnum.UNIT;
|
|
15
|
+
unit_off?: number;
|
|
16
|
+
effect?: DiscountUnitVouchersEffectTypes;
|
|
17
|
+
unit_type?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface DiscountAmount {
|
|
20
|
+
type?: DiscountVouchersTypesEnum.AMOUNT;
|
|
21
|
+
amount_off?: number;
|
|
22
|
+
}
|
|
23
|
+
export interface DiscountPercent {
|
|
24
|
+
type?: DiscountVouchersTypesEnum.PERCENT;
|
|
25
|
+
percent_off?: number;
|
|
26
|
+
amount_limit?: number;
|
|
27
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
interface MetadataSchemaProperty {
|
|
2
|
+
type: string;
|
|
3
|
+
array: boolean;
|
|
4
|
+
deleted?: boolean;
|
|
5
|
+
optional: boolean;
|
|
6
|
+
objectType?: string;
|
|
7
|
+
eq?: (string | number)[];
|
|
8
|
+
ne?: (string | number)[];
|
|
9
|
+
lt?: number;
|
|
10
|
+
lte?: number;
|
|
11
|
+
gt?: number;
|
|
12
|
+
gte?: number;
|
|
13
|
+
minLength?: number;
|
|
14
|
+
maxLength?: number;
|
|
15
|
+
exactLength?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface MetadataSchema {
|
|
18
|
+
id: string;
|
|
19
|
+
related_object: string;
|
|
20
|
+
properties: Record<string, MetadataSchemaProperty>;
|
|
21
|
+
allow_defined_only?: boolean;
|
|
22
|
+
created_at: string;
|
|
23
|
+
updated_at?: string;
|
|
24
|
+
object: 'metadata_schema';
|
|
25
|
+
}
|
|
26
|
+
export interface MetadataSchemasListResponse {
|
|
27
|
+
object: 'list';
|
|
28
|
+
total: number;
|
|
29
|
+
data_ref: 'schemas';
|
|
30
|
+
schemas: MetadataSchema[];
|
|
31
|
+
}
|
|
32
|
+
export declare type MetadataSchemasGetResponse = MetadataSchema;
|
|
33
|
+
export {};
|
package/dist/types/Orders.d.ts
CHANGED
|
@@ -18,8 +18,11 @@ export interface OrdersItem {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export interface OrdersCreate {
|
|
21
|
+
source_id?: string;
|
|
22
|
+
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
21
23
|
customer?: CustomerRequest;
|
|
22
24
|
amount?: number;
|
|
25
|
+
discount_amount?: number;
|
|
23
26
|
items?: OrdersItem[];
|
|
24
27
|
metadata?: Record<string, any>;
|
|
25
28
|
}
|
|
@@ -30,7 +33,13 @@ export interface OrdersCreateResponse {
|
|
|
30
33
|
updated_at?: string;
|
|
31
34
|
status?: 'CREATED' | 'PAID' | 'PROCESSING' | 'CANCELED' | 'FULFILLED';
|
|
32
35
|
amount?: number;
|
|
36
|
+
initial_amount?: number;
|
|
33
37
|
discount_amount?: number;
|
|
38
|
+
items_discount_amount?: number;
|
|
39
|
+
total_discount_amount?: number;
|
|
40
|
+
applied_discount_amount?: number;
|
|
41
|
+
items_applied_discount_amount?: number;
|
|
42
|
+
total_applied_discount_amount?: number;
|
|
34
43
|
items?: OrdersItem[];
|
|
35
44
|
metadata?: Record<string, any>;
|
|
36
45
|
customer?: CustomerRequest;
|
|
@@ -43,6 +52,7 @@ export interface OrdersUpdate {
|
|
|
43
52
|
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED';
|
|
44
53
|
items?: OrdersItem[];
|
|
45
54
|
amount?: number;
|
|
55
|
+
discount_amount?: number;
|
|
46
56
|
metadata?: Record<string, any>;
|
|
47
57
|
customer?: {
|
|
48
58
|
id: string;
|
package/dist/types/Products.d.ts
CHANGED
|
@@ -93,3 +93,13 @@ export interface ProductsListSkus {
|
|
|
93
93
|
total: number;
|
|
94
94
|
skus: ProductsGetSkuResponse[];
|
|
95
95
|
}
|
|
96
|
+
export interface SimpleProduct {
|
|
97
|
+
id: string;
|
|
98
|
+
source_id?: string;
|
|
99
|
+
name?: string;
|
|
100
|
+
}
|
|
101
|
+
export interface SimpleSku {
|
|
102
|
+
id: string;
|
|
103
|
+
source_id?: string;
|
|
104
|
+
sku?: string;
|
|
105
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DiscountAmount, DiscountPercent, DiscountUnit } from './
|
|
1
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
2
2
|
import { OrdersCreateResponse, OrdersItem } from './Orders';
|
|
3
3
|
import { SimpleCustomer } from './Customers';
|
|
4
4
|
import { ValidationRulesListAssignmentsResponse } from './ValidationRules';
|
|
5
|
+
import { ValidationSessionReleaseParams } from './ValidateSession';
|
|
5
6
|
export interface SimplePromotionTier {
|
|
6
7
|
tracking_id: string;
|
|
7
8
|
metadata?: Record<string, any>;
|
|
@@ -66,9 +67,7 @@ export interface PromotionTiersRedeemParams {
|
|
|
66
67
|
metadata?: Record<string, any>;
|
|
67
68
|
};
|
|
68
69
|
metadata?: Record<string, any>;
|
|
69
|
-
session?:
|
|
70
|
-
key: string;
|
|
71
|
-
};
|
|
70
|
+
session?: ValidationSessionReleaseParams;
|
|
72
71
|
}
|
|
73
72
|
export interface PromotionTiersRedeemResponse {
|
|
74
73
|
id: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DiscountAmount, DiscountPercent, DiscountUnit } from './
|
|
1
|
+
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher';
|
|
2
2
|
import { OrdersItem } from './Orders';
|
|
3
3
|
import { PromotionTier } from './PromotionTiers';
|
|
4
4
|
import { SimpleCustomer } from './Customers';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
import { OrdersCreateResponse } from './Orders';
|
|
2
|
-
import { RewardsCreateResponse } from './Rewards';
|
|
3
|
-
import { SimpleCustomer } from './Customers';
|
|
1
|
+
import { OrdersCreateResponse, OrdersCreate } from './Orders';
|
|
2
|
+
import { RewardsCreateResponse, RewardRedemptionParams } from './Rewards';
|
|
3
|
+
import { CustomersCreateBody, SimpleCustomer } from './Customers';
|
|
4
4
|
import { VouchersResponse } from './Vouchers';
|
|
5
|
+
import { GiftRedemptionParams } from './Gift';
|
|
6
|
+
import { ValidationSessionParams, ValidationSessionReleaseParams } from './ValidateSession';
|
|
7
|
+
import { StackableOptions, StackableRedeemableParams } from './Stackable';
|
|
5
8
|
export interface RedemptionsRedeemBody {
|
|
6
9
|
tracking_id?: string;
|
|
7
10
|
customer?: SimpleCustomer & {
|
|
@@ -9,16 +12,9 @@ export interface RedemptionsRedeemBody {
|
|
|
9
12
|
};
|
|
10
13
|
order?: Pick<Partial<OrdersCreateResponse>, 'id' | 'source_id' | 'amount' | 'items' | 'status' | 'metadata'>;
|
|
11
14
|
metadata?: Record<string, any>;
|
|
12
|
-
reward?:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
gift?: {
|
|
17
|
-
credits: number;
|
|
18
|
-
};
|
|
19
|
-
session?: {
|
|
20
|
-
key: string;
|
|
21
|
-
};
|
|
15
|
+
reward?: RewardRedemptionParams;
|
|
16
|
+
gift?: GiftRedemptionParams;
|
|
17
|
+
session?: ValidationSessionReleaseParams;
|
|
22
18
|
}
|
|
23
19
|
export interface RedemptionsRedeemResponse {
|
|
24
20
|
id: string;
|
|
@@ -148,3 +144,57 @@ export declare type SimpleRollback = Pick<RedemptionsRollbackResponse, 'id' | 'o
|
|
|
148
144
|
points: number;
|
|
149
145
|
};
|
|
150
146
|
};
|
|
147
|
+
export interface RedemptionsRedeemStackableParams {
|
|
148
|
+
options?: StackableOptions;
|
|
149
|
+
redeemables: StackableRedeemableParams[];
|
|
150
|
+
session?: ValidationSessionParams;
|
|
151
|
+
order?: OrdersCreate;
|
|
152
|
+
customer?: CustomersCreateBody;
|
|
153
|
+
metadata?: Record<string, any>;
|
|
154
|
+
}
|
|
155
|
+
export declare type RedemptionsRedeemStackableRedemptionResult = RedemptionsRedeemResponse & {
|
|
156
|
+
redemption: string;
|
|
157
|
+
};
|
|
158
|
+
export declare type RedemptionsRedeemStackableOrderResponse = OrdersCreateResponse & {
|
|
159
|
+
redemptions?: Record<string, {
|
|
160
|
+
date: string;
|
|
161
|
+
rollback_id?: string;
|
|
162
|
+
rollback_date?: string;
|
|
163
|
+
related_object_type: 'redemption';
|
|
164
|
+
related_object_id: string;
|
|
165
|
+
stacked: string[];
|
|
166
|
+
rollback_stacked?: string[];
|
|
167
|
+
}>;
|
|
168
|
+
};
|
|
169
|
+
export interface RedemptionsRedeemStackableResponse {
|
|
170
|
+
redemptions: RedemptionsRedeemStackableRedemptionResult[];
|
|
171
|
+
parent_redemption: {
|
|
172
|
+
id: string;
|
|
173
|
+
object: 'redemption';
|
|
174
|
+
date: string;
|
|
175
|
+
customer_id?: string;
|
|
176
|
+
tracking_id?: string;
|
|
177
|
+
metadata?: Record<string, any>;
|
|
178
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
179
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
180
|
+
customer?: SimpleCustomer;
|
|
181
|
+
related_object_type: 'redemption';
|
|
182
|
+
related_object_id: string;
|
|
183
|
+
};
|
|
184
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
185
|
+
}
|
|
186
|
+
export interface RedemptionsRollbackStackableResponse {
|
|
187
|
+
rollbacks: RedemptionsRedeemStackableRedemptionResult[];
|
|
188
|
+
parent_rollback: {
|
|
189
|
+
id: string;
|
|
190
|
+
date: string;
|
|
191
|
+
customer_id?: string;
|
|
192
|
+
tracking_id?: string;
|
|
193
|
+
metadata?: Record<string, any>;
|
|
194
|
+
result: 'SUCCESS' | 'FAILURE';
|
|
195
|
+
order?: OrdersCreateResponse;
|
|
196
|
+
customer?: SimpleCustomer;
|
|
197
|
+
redemption: string;
|
|
198
|
+
};
|
|
199
|
+
order?: RedemptionsRedeemStackableOrderResponse;
|
|
200
|
+
}
|
package/dist/types/Rewards.d.ts
CHANGED
|
@@ -111,4 +111,9 @@ export declare type RewardsUpdateAssignment = RewardsCreateAssignment & {
|
|
|
111
111
|
id: string;
|
|
112
112
|
};
|
|
113
113
|
export declare type RewardsUpdateAssignmentResponse = RewardsAssignmentObject;
|
|
114
|
+
export interface RewardRedemptionParams {
|
|
115
|
+
points?: number;
|
|
116
|
+
assignment_id?: string;
|
|
117
|
+
id?: string;
|
|
118
|
+
}
|
|
114
119
|
export {};
|