@voucherify/sdk 2.9.2 → 2.9.4
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/dist/ApiLimitsHandler.d.ts +13 -10
- package/dist/AsyncActions.d.ts +17 -15
- package/dist/Balance.d.ts +15 -12
- package/dist/Campaigns.d.ts +66 -58
- package/dist/Categories.d.ts +29 -26
- package/dist/ClientSide.d.ts +77 -53
- package/dist/Consents.d.ts +13 -10
- package/dist/Customers.d.ts +75 -72
- package/dist/Distributions.d.ts +29 -22
- package/dist/Events.d.ts +15 -10
- package/dist/Exports.d.ts +25 -22
- package/dist/Loyalties.d.ts +171 -159
- package/dist/MetadataSchemas.d.ts +17 -14
- package/dist/Orders.d.ts +32 -27
- package/dist/ProductCollections.d.ts +30 -26
- package/dist/Products.d.ts +66 -63
- package/dist/PromotionTiers.d.ts +43 -34
- package/dist/Promotions.d.ts +30 -18
- package/dist/PromotionsStacks.d.ts +34 -30
- package/dist/Qualifications.d.ts +24 -10
- package/dist/Redemptions.d.ts +53 -35
- package/dist/RequestController.d.ts +31 -29
- package/dist/Rewards.d.ts +46 -43
- package/dist/Segments.d.ts +25 -22
- package/dist/ValidationRules.d.ts +47 -43
- package/dist/Validations.d.ts +39 -17
- package/dist/VoucherifyClientSide.d.ts +112 -86
- package/dist/VoucherifyError.d.ts +23 -20
- package/dist/VoucherifyServerSide.d.ts +170 -131
- package/dist/Vouchers.d.ts +84 -78
- package/dist/helpers.d.ts +20 -18
- package/dist/index.d.ts +63 -25
- package/dist/types/ApplicableTo.d.ts +32 -30
- package/dist/types/AsyncActions.d.ts +23 -21
- package/dist/types/Balance.d.ts +18 -16
- package/dist/types/Campaigns.d.ts +124 -120
- package/dist/types/Categories.d.ts +40 -38
- package/dist/types/ClientSide.d.ts +145 -134
- package/dist/types/Consents.d.ts +34 -33
- package/dist/types/Customers.d.ts +363 -361
- package/dist/types/DiscountVoucher.d.ts +94 -93
- package/dist/types/Distributions.d.ts +148 -144
- package/dist/types/Events.d.ts +21 -17
- package/dist/types/Exports.d.ts +151 -149
- package/dist/types/Gift.d.ts +5 -3
- package/dist/types/Loyalties.d.ts +1061 -1057
- package/dist/types/MetadataSchemas.d.ts +34 -33
- package/dist/types/Orders.d.ts +199 -195
- package/dist/types/ProductCollections.d.ts +99 -96
- package/dist/types/Products.d.ts +108 -106
- package/dist/types/PromotionTiers.d.ts +131 -127
- package/dist/types/Promotions.d.ts +113 -108
- package/dist/types/PromotionsStacks.d.ts +74 -71
- package/dist/types/Qualifications.d.ts +92 -86
- package/dist/types/Redemptions.d.ts +215 -205
- package/dist/types/Rewards.d.ts +220 -219
- package/dist/types/Segments.d.ts +34 -32
- package/dist/types/Stackable.d.ts +106 -101
- package/dist/types/UtilityTypes.d.ts +5 -3
- package/dist/types/ValidateSession.d.ts +19 -17
- package/dist/types/ValidationError.d.ts +9 -7
- package/dist/types/ValidationRules.d.ts +96 -93
- package/dist/types/Validations.d.ts +109 -98
- package/dist/types/Vouchers.d.ts +452 -364
- package/dist/types/index.d.ts +27 -25
- package/dist/voucherifysdk.cjs +2023 -0
- package/dist/voucherifysdk.cjs.map +1 -0
- package/dist/voucherifysdk.esm.js +981 -1256
- package/dist/voucherifysdk.esm.js.map +1 -1
- package/package.json +13 -9
- package/CHANGELOG.md +0 -663
- package/dist/voucherifysdk.umd.development.js +0 -2270
- package/dist/voucherifysdk.umd.development.js.map +0 -1
- package/dist/voucherifysdk.umd.production.min.js +0 -2
- package/dist/voucherifysdk.umd.production.min.js.map +0 -1
package/dist/Segments.d.ts
CHANGED
|
@@ -1,22 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { SegmentsCreate, SegmentsCreateResponse, SegmentsListResponse } from './types/Segments.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
|
|
4
|
+
declare class Segments {
|
|
5
|
+
private client;
|
|
6
|
+
constructor(client: RequestController);
|
|
7
|
+
/**
|
|
8
|
+
* @see https://docs.voucherify.io/reference/create-segment
|
|
9
|
+
*/
|
|
10
|
+
create(segment: SegmentsCreate): Promise<SegmentsCreateResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* @see https://docs.voucherify.io/reference/get-segment
|
|
13
|
+
*/
|
|
14
|
+
get(segmentId: string): Promise<SegmentsCreateResponse>;
|
|
15
|
+
/**
|
|
16
|
+
* @see https://docs.voucherify.io/reference/delete-segment
|
|
17
|
+
*/
|
|
18
|
+
delete(segmentId: string): Promise<unknown>;
|
|
19
|
+
/**
|
|
20
|
+
* @see https://docs.voucherify.io/reference/list-segments
|
|
21
|
+
*/
|
|
22
|
+
list(customerId: string): Promise<SegmentsListResponse>;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { Segments };
|
|
@@ -1,43 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
1
|
+
import { ValidationRulesCreate, ValidationRulesCreateResponse, ValidationRulesGetResponse, ValidationRulesUpdate, ValidationRulesCreateAssignment, ValidationRulesCreateAssignmentResponse, ValidationRulesValidateResponse, ValidationRulesListParams, ValidationRulesListResponse, ValidationRulesListRulesAssignmentsRequestQuery, ValidationRulesListRulesAssignmentsResponseBody, ValidationRulesListAssignmentsParams, ValidationRulesListAssignmentsResponse } from './types/ValidationRules.js';
|
|
2
|
+
import { RequestController } from './RequestController.js';
|
|
3
|
+
import './types/ApplicableTo.js';
|
|
4
|
+
|
|
5
|
+
declare class ValidationRules {
|
|
6
|
+
private client;
|
|
7
|
+
constructor(client: RequestController);
|
|
8
|
+
/**
|
|
9
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules
|
|
10
|
+
*/
|
|
11
|
+
create(validationRule: ValidationRulesCreate): Promise<ValidationRulesCreateResponse>;
|
|
12
|
+
/**
|
|
13
|
+
* @see https://docs.voucherify.io/reference/get-validation-rules
|
|
14
|
+
*/
|
|
15
|
+
get(validationRuleId: string): Promise<ValidationRulesGetResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* @see https://docs.voucherify.io/reference/update-validation-rules
|
|
18
|
+
*/
|
|
19
|
+
update(validationRule: ValidationRulesUpdate): Promise<ValidationRulesCreateResponse>;
|
|
20
|
+
/**
|
|
21
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules
|
|
22
|
+
*/
|
|
23
|
+
delete(validationRuleId: string): Promise<unknown>;
|
|
24
|
+
/**
|
|
25
|
+
* @see https://docs.voucherify.io/reference/create-validation-rules-assignment
|
|
26
|
+
*/
|
|
27
|
+
createAssignment(validationRuleId: string, assignment: ValidationRulesCreateAssignment): Promise<ValidationRulesCreateAssignmentResponse>;
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/delete-validation-rules-assignment
|
|
30
|
+
*/
|
|
31
|
+
deleteAssignment(validationRuleId: string, assignmentId: string): Promise<unknown>;
|
|
32
|
+
validate(validationRuleId: string, params?: any): Promise<ValidationRulesValidateResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules
|
|
35
|
+
*/
|
|
36
|
+
list(params?: ValidationRulesListParams): Promise<ValidationRulesListResponse>;
|
|
37
|
+
/**
|
|
38
|
+
* @see https://docs.voucherify.io/reference/list-validation-rules-assignments
|
|
39
|
+
*/
|
|
40
|
+
listRulesAssignments(params?: ValidationRulesListRulesAssignmentsRequestQuery): Promise<ValidationRulesListRulesAssignmentsResponseBody>;
|
|
41
|
+
/**
|
|
42
|
+
* @see https://docs.voucherify.io/reference/list-validation-rule-assignments
|
|
43
|
+
*/
|
|
44
|
+
listAssignments(validationRuleId: string, params?: ValidationRulesListAssignmentsParams): Promise<ValidationRulesListAssignmentsResponse>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { ValidationRules };
|
package/dist/Validations.d.ts
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
import { ValidationsValidateVoucherParams, ValidationsValidateVoucherResponse, ValidationsValidateCode, ValidationsValidateContext, ValidationsValidateStackableParams, ValidationValidateStackableResponse } from './types/Validations.js';
|
|
2
|
+
import { PromotionsValidateResponse } from './types/Promotions.js';
|
|
3
|
+
import { RequestController } from './RequestController.js';
|
|
4
|
+
import { Promotions } from './Promotions.js';
|
|
5
|
+
import './types/DiscountVoucher.js';
|
|
6
|
+
import './types/Customers.js';
|
|
7
|
+
import './types/Stackable.js';
|
|
8
|
+
import './types/Rewards.js';
|
|
9
|
+
import './types/Gift.js';
|
|
10
|
+
import './types/Orders.js';
|
|
11
|
+
import './types/ApplicableTo.js';
|
|
12
|
+
import './types/Products.js';
|
|
13
|
+
import './types/Loyalties.js';
|
|
14
|
+
import './types/ValidationRules.js';
|
|
15
|
+
import './types/Vouchers.js';
|
|
16
|
+
import './types/Categories.js';
|
|
17
|
+
import './types/ValidationError.js';
|
|
18
|
+
import './types/ValidateSession.js';
|
|
19
|
+
import './types/PromotionTiers.js';
|
|
20
|
+
import './PromotionTiers.js';
|
|
21
|
+
import './PromotionsStacks.js';
|
|
22
|
+
import './types/PromotionsStacks.js';
|
|
23
|
+
|
|
24
|
+
declare class Validations {
|
|
25
|
+
private client;
|
|
26
|
+
private promotions;
|
|
27
|
+
constructor(client: RequestController, promotions: Promotions);
|
|
28
|
+
/**
|
|
29
|
+
* @see https://docs.voucherify.io/reference/validate-voucher
|
|
30
|
+
*/
|
|
31
|
+
validateVoucher(code: string, params?: ValidationsValidateVoucherParams): Promise<ValidationsValidateVoucherResponse>;
|
|
32
|
+
validate(code: string | ValidationsValidateCode, context?: ValidationsValidateContext): Promise<PromotionsValidateResponse> | Promise<ValidationsValidateVoucherResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* @see https://docs.voucherify.io/reference/validate-stacked-discounts-1
|
|
35
|
+
*/
|
|
36
|
+
validateStackable(params: ValidationsValidateStackableParams): Promise<ValidationValidateStackableResponse>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { Validations };
|
|
@@ -1,86 +1,112 @@
|
|
|
1
|
-
import { ClientSide } from './ClientSide';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* ```
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
1
|
+
import { ClientSide } from './ClientSide.js';
|
|
2
|
+
import './types/Customers.js';
|
|
3
|
+
import './types/DiscountVoucher.js';
|
|
4
|
+
import './types/ClientSide.js';
|
|
5
|
+
import './types/Vouchers.js';
|
|
6
|
+
import './types/Orders.js';
|
|
7
|
+
import './types/Consents.js';
|
|
8
|
+
import './types/Distributions.js';
|
|
9
|
+
import './types/PromotionTiers.js';
|
|
10
|
+
import './types/ValidationRules.js';
|
|
11
|
+
import './types/ApplicableTo.js';
|
|
12
|
+
import './types/ValidateSession.js';
|
|
13
|
+
import './types/Validations.js';
|
|
14
|
+
import './types/Stackable.js';
|
|
15
|
+
import './types/Rewards.js';
|
|
16
|
+
import './types/Gift.js';
|
|
17
|
+
import './types/Products.js';
|
|
18
|
+
import './types/Loyalties.js';
|
|
19
|
+
import './types/Categories.js';
|
|
20
|
+
import './types/ValidationError.js';
|
|
21
|
+
import './types/Promotions.js';
|
|
22
|
+
import './types/Redemptions.js';
|
|
23
|
+
import './types/Qualifications.js';
|
|
24
|
+
import './types/Exports.js';
|
|
25
|
+
import './RequestController.js';
|
|
26
|
+
|
|
27
|
+
interface VoucherifyClientSideOptions {
|
|
28
|
+
/**
|
|
29
|
+
* Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
|
30
|
+
*
|
|
31
|
+
* ```javascript
|
|
32
|
+
* const client = VoucherifyClientSide({
|
|
33
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
34
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
35
|
+
* apiUrl: 'https://<region>.api.voucherify.io'
|
|
36
|
+
* })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
apiUrl?: string;
|
|
40
|
+
/**
|
|
41
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Client-side Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
42
|
+
*
|
|
43
|
+
* ```javascript
|
|
44
|
+
* const client = VoucherifyClientSide({
|
|
45
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
46
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
47
|
+
* })
|
|
48
|
+
* ```
|
|
49
|
+
*/
|
|
50
|
+
clientApplicationId: string;
|
|
51
|
+
/**
|
|
52
|
+
* [Log-in](https://app.voucherify.io/#/login) to Voucherify web interface and obtain your `Client-side Keys` from [Configuration](https://app.voucherify.io/#/app/core/projects/current/general):
|
|
53
|
+
*
|
|
54
|
+
* ```javascript
|
|
55
|
+
* const client = VoucherifyClientSide({
|
|
56
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
57
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY'
|
|
58
|
+
* })
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
clientSecretKey: string;
|
|
62
|
+
/**
|
|
63
|
+
* Set customer identity when using React Widget. In other situations, use `setIdentity` method:
|
|
64
|
+
*
|
|
65
|
+
* ```javascript
|
|
66
|
+
* client.setIdentity('gustav@purpleson.com')
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
trackingId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* **(Required in Node.js)** Set the origin from where the requests are made.
|
|
72
|
+
*
|
|
73
|
+
* ```javascript
|
|
74
|
+
* const client = VoucherifyClientSide({
|
|
75
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
76
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
77
|
+
* origin: 'your-domain.com'
|
|
78
|
+
* })
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
81
|
+
* @note in the browser, this option will be ignored. The `origin` header is a [forbidden header name](https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name) and it'll be automatically set by the browser for every request.
|
|
82
|
+
*/
|
|
83
|
+
origin?: string;
|
|
84
|
+
/**
|
|
85
|
+
* You can pass additional headers to requests made by the API Client.
|
|
86
|
+
* It can prove to be useful when debugging various scenarios.
|
|
87
|
+
* ```javascript
|
|
88
|
+
* const voucherify = VoucherifyServerSide({
|
|
89
|
+
* clientApplicationId: 'YOUR-CLIENT-APPLICATION-ID',
|
|
90
|
+
* clientSecretKey: 'YOUR-CLIENT-SECRET-KEY',
|
|
91
|
+
* customHeaders: {
|
|
92
|
+
* "DEBUG-HEADER": "my_value",
|
|
93
|
+
* "TEST-HEADER": "another_value"
|
|
94
|
+
* }
|
|
95
|
+
* })
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
customHeaders?: Record<string, string>;
|
|
99
|
+
/**
|
|
100
|
+
* If you wish to include original Axios error in VoucherifyError instance set this to true
|
|
101
|
+
* It can prove to be useful when debugging various scenarios.
|
|
102
|
+
* The original Axios error will be included in cause property of VoucherifyError
|
|
103
|
+
*/
|
|
104
|
+
exposeErrorCause?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Optionally, you can set timeout in miliseconds. After this time request will be aborted. By default Voucherify's API has timeout value of 3 minutes.
|
|
107
|
+
*/
|
|
108
|
+
timeoutMs?: number;
|
|
109
|
+
}
|
|
110
|
+
declare function VoucherifyClientSide(options: VoucherifyClientSideOptions): ClientSide;
|
|
111
|
+
|
|
112
|
+
export { ClientSide, VoucherifyClientSide, type VoucherifyClientSideOptions };
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { AxiosError } from 'axios';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
import { AxiosError } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
declare class VoucherifyError extends Error {
|
|
7
|
+
code: number;
|
|
8
|
+
key: string;
|
|
9
|
+
details?: string;
|
|
10
|
+
request_id?: string;
|
|
11
|
+
resource_id?: string;
|
|
12
|
+
resource_type?: string;
|
|
13
|
+
related_object_ids?: string[];
|
|
14
|
+
related_object_type?: string;
|
|
15
|
+
related_object_total?: number;
|
|
16
|
+
error?: {
|
|
17
|
+
message: string;
|
|
18
|
+
};
|
|
19
|
+
cause?: AxiosError;
|
|
20
|
+
constructor(statusCode: number, body?: unknown, axiosError?: AxiosError);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export { VoucherifyError };
|