@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
|
@@ -1,101 +1,106 @@
|
|
|
1
|
-
import { RewardRedemptionParams } from './Rewards';
|
|
2
|
-
import { GiftRedemptionParams } from './Gift';
|
|
3
|
-
import { OrdersCreateResponse } from './Orders';
|
|
4
|
-
import { ApplicableToResultList } from './ApplicableTo';
|
|
5
|
-
import { DiscountVouchersTypes, DiscountVouchersEffectTypes, DiscountUnitVouchersEffectTypes } from './DiscountVoucher';
|
|
6
|
-
import {
|
|
7
|
-
import { LoyaltyPointsTransfer } from './Loyalties';
|
|
8
|
-
import { ValidationError } from './ValidationError';
|
|
9
|
-
import { Category } from './Categories';
|
|
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
|
-
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
};
|
|
101
|
-
|
|
1
|
+
import { RewardRedemptionParams } from './Rewards.js';
|
|
2
|
+
import { GiftRedemptionParams } from './Gift.js';
|
|
3
|
+
import { OrdersCreateResponse } from './Orders.js';
|
|
4
|
+
import { ApplicableToResultList } from './ApplicableTo.js';
|
|
5
|
+
import { DiscountVouchersTypes, DiscountVouchersEffectTypes, DiscountUnitVouchersEffectTypes } from './DiscountVoucher.js';
|
|
6
|
+
import { SimpleSku, SimpleProduct } from './Products.js';
|
|
7
|
+
import { LoyaltyPointsTransfer } from './Loyalties.js';
|
|
8
|
+
import { ValidationError } from './ValidationError.js';
|
|
9
|
+
import { Category } from './Categories.js';
|
|
10
|
+
import './Customers.js';
|
|
11
|
+
import './ValidationRules.js';
|
|
12
|
+
import './Vouchers.js';
|
|
13
|
+
|
|
14
|
+
type ExpandOption = 'order' | 'redeemable' | 'redemption';
|
|
15
|
+
interface StackableOptions {
|
|
16
|
+
expand: ExpandOption[];
|
|
17
|
+
}
|
|
18
|
+
type StackableRedeemableObject = 'promotion_stack' | 'promotion_tier' | 'voucher';
|
|
19
|
+
interface StackableRedeemableParams {
|
|
20
|
+
object: StackableRedeemableObject;
|
|
21
|
+
id: string;
|
|
22
|
+
reward?: RewardRedemptionParams;
|
|
23
|
+
gift?: GiftRedemptionParams;
|
|
24
|
+
}
|
|
25
|
+
type StackableRedeemableResponseStatus = 'APPLICABLE' | 'INAPPLICABLE' | 'SKIPPED';
|
|
26
|
+
interface StackableRedeemableResultDiscountUnit {
|
|
27
|
+
effect: DiscountUnitVouchersEffectTypes;
|
|
28
|
+
unit_off: number;
|
|
29
|
+
unit_type: string;
|
|
30
|
+
sku?: SimpleSku;
|
|
31
|
+
product?: SimpleProduct;
|
|
32
|
+
}
|
|
33
|
+
interface StackableRedeemableResultDiscount {
|
|
34
|
+
type: DiscountVouchersTypes;
|
|
35
|
+
effect: DiscountVouchersEffectTypes;
|
|
36
|
+
amount_off?: number;
|
|
37
|
+
amount_off_formula?: string;
|
|
38
|
+
percent_off?: number;
|
|
39
|
+
percent_off_formula?: string;
|
|
40
|
+
amount_limit?: number;
|
|
41
|
+
fixed_amount?: number;
|
|
42
|
+
fixed_amount_formula?: string;
|
|
43
|
+
unit_off?: number;
|
|
44
|
+
unit_off_formula?: string;
|
|
45
|
+
unit_type?: string;
|
|
46
|
+
sku?: SimpleSku;
|
|
47
|
+
product?: SimpleProduct;
|
|
48
|
+
units?: StackableRedeemableResultDiscountUnit[];
|
|
49
|
+
}
|
|
50
|
+
interface StackableRedeemableResultGift {
|
|
51
|
+
credits?: number;
|
|
52
|
+
}
|
|
53
|
+
interface StackableRedeemableResultLoyaltyCard {
|
|
54
|
+
points?: number;
|
|
55
|
+
transfers?: LoyaltyPointsTransfer[];
|
|
56
|
+
}
|
|
57
|
+
interface StackableRedeemableResultResponse {
|
|
58
|
+
discount?: StackableRedeemableResultDiscount;
|
|
59
|
+
gift?: StackableRedeemableResultGift;
|
|
60
|
+
loyalty_card?: StackableRedeemableResultLoyaltyCard;
|
|
61
|
+
error?: ValidationError;
|
|
62
|
+
details?: {
|
|
63
|
+
key?: string;
|
|
64
|
+
message?: string;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
interface StackableRedeemableResponse {
|
|
68
|
+
status: StackableRedeemableResponseStatus;
|
|
69
|
+
id: string;
|
|
70
|
+
object: StackableRedeemableObject;
|
|
71
|
+
order?: OrdersCreateResponse;
|
|
72
|
+
applicable_to?: ApplicableToResultList;
|
|
73
|
+
inapplicable_to?: ApplicableToResultList;
|
|
74
|
+
result?: StackableRedeemableResultResponse;
|
|
75
|
+
metadata?: Record<string, any>;
|
|
76
|
+
categories?: Category[];
|
|
77
|
+
}
|
|
78
|
+
type StackableRedeemableInapplicableResponse = {
|
|
79
|
+
status: 'INAPPLICABLE';
|
|
80
|
+
id: string;
|
|
81
|
+
object: 'voucher' | 'promotion_tier';
|
|
82
|
+
result: {
|
|
83
|
+
error?: ValidationError;
|
|
84
|
+
details?: {
|
|
85
|
+
key?: string;
|
|
86
|
+
message?: string;
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
metadata?: Record<string, unknown>;
|
|
90
|
+
categories?: Category[];
|
|
91
|
+
};
|
|
92
|
+
type StackableRedeemableSkippedResponse = {
|
|
93
|
+
status: 'SKIPPED';
|
|
94
|
+
id: string;
|
|
95
|
+
object: 'voucher' | 'promotion_tier';
|
|
96
|
+
result: {
|
|
97
|
+
details?: {
|
|
98
|
+
key?: string;
|
|
99
|
+
message?: string;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
metadata?: Record<string, unknown>;
|
|
103
|
+
categories?: Category[];
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type { StackableOptions, StackableRedeemableInapplicableResponse, StackableRedeemableObject, StackableRedeemableParams, StackableRedeemableResponse, StackableRedeemableResponseStatus, StackableRedeemableResultDiscount, StackableRedeemableResultDiscountUnit, StackableRedeemableResultGift, StackableRedeemableResultLoyaltyCard, StackableRedeemableResultResponse, StackableRedeemableSkippedResponse };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
[Property in Key]-?: Type[Property];
|
|
3
|
-
};
|
|
1
|
+
type WithRequiredProperty<Type, Key extends keyof Type> = Type & {
|
|
2
|
+
[Property in Key]-?: Type[Property];
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type { WithRequiredProperty };
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
key?: string;
|
|
5
|
-
type?: ValidationSessionType;
|
|
6
|
-
ttl?: number;
|
|
7
|
-
ttl_unit?: ValidationSessionTTLUnit;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
key: string;
|
|
11
|
-
type: ValidationSessionType;
|
|
12
|
-
ttl: number;
|
|
13
|
-
ttl_unit: ValidationSessionTTLUnit;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
key: string;
|
|
17
|
-
}
|
|
1
|
+
type ValidationSessionType = 'LOCK';
|
|
2
|
+
type ValidationSessionTTLUnit = 'DAYS' | 'HOURS' | 'MICROSECONDS' | 'MILLISECONDS' | 'MINUTES' | 'NANOSECONDS' | 'SECONDS';
|
|
3
|
+
interface ValidationSessionParams {
|
|
4
|
+
key?: string;
|
|
5
|
+
type?: ValidationSessionType;
|
|
6
|
+
ttl?: number;
|
|
7
|
+
ttl_unit?: ValidationSessionTTLUnit;
|
|
8
|
+
}
|
|
9
|
+
interface ValidationSessionResponse {
|
|
10
|
+
key: string;
|
|
11
|
+
type: ValidationSessionType;
|
|
12
|
+
ttl: number;
|
|
13
|
+
ttl_unit: ValidationSessionTTLUnit;
|
|
14
|
+
}
|
|
15
|
+
interface ValidationSessionReleaseParams {
|
|
16
|
+
key: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export type { ValidationSessionParams, ValidationSessionReleaseParams, ValidationSessionResponse, ValidationSessionTTLUnit, ValidationSessionType };
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
code?: number;
|
|
3
|
-
key?: string;
|
|
4
|
-
message: string;
|
|
5
|
-
details?: string;
|
|
6
|
-
request_id?: string;
|
|
7
|
-
}
|
|
1
|
+
interface ValidationError {
|
|
2
|
+
code?: number;
|
|
3
|
+
key?: string;
|
|
4
|
+
message: string;
|
|
5
|
+
details?: string;
|
|
6
|
+
request_id?: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export type { ValidationError };
|
|
@@ -1,93 +1,96 @@
|
|
|
1
|
-
import { ApplicableToResultList } from './ApplicableTo';
|
|
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
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
1
|
+
import { ApplicableToResultList } from './ApplicableTo.js';
|
|
2
|
+
|
|
3
|
+
interface ValidationRulesCreate {
|
|
4
|
+
name: string;
|
|
5
|
+
error?: {
|
|
6
|
+
message?: string;
|
|
7
|
+
};
|
|
8
|
+
rules?: {
|
|
9
|
+
logic?: string;
|
|
10
|
+
[rule: string]: any;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface ValidationRulesCreateResponse {
|
|
14
|
+
id: string;
|
|
15
|
+
name: string;
|
|
16
|
+
error?: {
|
|
17
|
+
message?: string;
|
|
18
|
+
};
|
|
19
|
+
rules?: {
|
|
20
|
+
logic?: string;
|
|
21
|
+
[rule: string]: any;
|
|
22
|
+
};
|
|
23
|
+
created_at: string;
|
|
24
|
+
updated_at?: string;
|
|
25
|
+
object: 'validation_rules';
|
|
26
|
+
}
|
|
27
|
+
interface ValidationRulesValidateResponse {
|
|
28
|
+
valid: boolean;
|
|
29
|
+
rule_id: string;
|
|
30
|
+
applicable_to: ApplicableToResultList;
|
|
31
|
+
}
|
|
32
|
+
type ValidationRulesGetResponse = ValidationRulesCreateResponse & {
|
|
33
|
+
assignments_count?: string;
|
|
34
|
+
};
|
|
35
|
+
type ValidationRulesUpdate = Partial<ValidationRulesCreate> & {
|
|
36
|
+
id: string;
|
|
37
|
+
};
|
|
38
|
+
type ValidationRulesUpdateResponse = ValidationRulesCreateResponse;
|
|
39
|
+
interface ValidationRulesCreateAssignment {
|
|
40
|
+
voucher?: string;
|
|
41
|
+
campaign?: string;
|
|
42
|
+
promotion_tier?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ValidationRulesCreateAssignmentResponse {
|
|
45
|
+
id: string;
|
|
46
|
+
rule_id: string;
|
|
47
|
+
related_object_id?: string;
|
|
48
|
+
related_object_type?: string;
|
|
49
|
+
created_at?: string;
|
|
50
|
+
updated_at: string;
|
|
51
|
+
object: 'validation_rules_assignment';
|
|
52
|
+
}
|
|
53
|
+
interface ValidationRulesListParams {
|
|
54
|
+
limit?: number;
|
|
55
|
+
page?: number;
|
|
56
|
+
}
|
|
57
|
+
interface ValidationRulesListResponse {
|
|
58
|
+
object: 'list';
|
|
59
|
+
total: number;
|
|
60
|
+
data_ref: 'data';
|
|
61
|
+
data: ValidationRulesGetResponse[];
|
|
62
|
+
}
|
|
63
|
+
interface ValidationRulesListAssignmentsParams {
|
|
64
|
+
limit?: number;
|
|
65
|
+
page?: number;
|
|
66
|
+
}
|
|
67
|
+
interface ValidationRulesListAssignmentsResponse {
|
|
68
|
+
object: 'list';
|
|
69
|
+
total: number;
|
|
70
|
+
data_ref: 'data';
|
|
71
|
+
data: ValidationRulesCreateAssignmentResponse[];
|
|
72
|
+
}
|
|
73
|
+
type ValidationRulesAssignmentsList = ValidationRulesListResponse;
|
|
74
|
+
interface ValidationRulesAssignment {
|
|
75
|
+
id: string;
|
|
76
|
+
rule_id: string;
|
|
77
|
+
related_object_id: string;
|
|
78
|
+
related_object_type: string;
|
|
79
|
+
created_at: string;
|
|
80
|
+
object: 'validation_rules_assignment';
|
|
81
|
+
}
|
|
82
|
+
interface ValidationRulesListRulesAssignmentsRequestQuery {
|
|
83
|
+
related_object_id?: string;
|
|
84
|
+
rule?: string;
|
|
85
|
+
page?: number;
|
|
86
|
+
limit?: number;
|
|
87
|
+
order?: 'created_at' | '-created_at';
|
|
88
|
+
}
|
|
89
|
+
interface ValidationRulesListRulesAssignmentsResponseBody {
|
|
90
|
+
object: 'list';
|
|
91
|
+
data_ref: 'data';
|
|
92
|
+
total: number;
|
|
93
|
+
data: ValidationRulesAssignment[];
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export type { ValidationRulesAssignment, ValidationRulesAssignmentsList, ValidationRulesCreate, ValidationRulesCreateAssignment, ValidationRulesCreateAssignmentResponse, ValidationRulesCreateResponse, ValidationRulesGetResponse, ValidationRulesListAssignmentsParams, ValidationRulesListAssignmentsResponse, ValidationRulesListParams, ValidationRulesListResponse, ValidationRulesListRulesAssignmentsRequestQuery, ValidationRulesListRulesAssignmentsResponseBody, ValidationRulesUpdate, ValidationRulesUpdateResponse, ValidationRulesValidateResponse };
|